Error: [CDC:ErrStartTsBeforeGC]fail to create or maintain changefeed because start-ts 455932326430376158 is earlier than or equal to GC safepoint at 455933294501953841
// EnsureChangefeedStartTsSafety checks if the startTs less than the minimum of
// service GC safepoint and this function will update the service GC to startTs
func EnsureChangefeedStartTsSafety(
ctx context.Context, pdCli pd.Client,
gcServiceIDPrefix string,
changefeedID model.ChangeFeedID,
TTL int64, startTs uint64,
) error {
minServiceGCTs, err := SetServiceGCSafepoint(
ctx, pdCli,
gcServiceIDPrefix+changefeedID.Namespace+"_"+changefeedID.ID,
TTL, startTs)
if err != nil {
return errors.Trace(err)
}
// startTs should be greater than or equal to minServiceGCTs + 1, otherwise gcManager
// would return a ErrSnapshotLostByGC even though the changefeed would appear to be successfully
// created/resumed. See issue #6350 for more detail.
if startTs > 0 && startTs < minServiceGCTs+1 {
return cerrors.ErrStartTsBeforeGC.GenWithStackByArgs(startTs, minServiceGCTs)
}
return nil
}