Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCheung96 committed May 24, 2023
1 parent 6188768 commit 5cadf0c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cdc/owner/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func (c *changefeed) tick(ctx cdcContext.Context, captures map[model.CaptureID]*
// be max uint64. In this case, we need to advance newResolvedTs to global barrier
// ts and advance newCheckpointTs to min table barrier ts.
if newResolvedTs == math.MaxUint64 || newCheckpointTs == math.MaxUint64 {
if newCheckpointTs != math.MaxUint64 || newResolvedTs != math.MaxUint64 {
if newCheckpointTs != newResolvedTs {
log.Panic("newResolvedTs and newCheckpointTs should be both max uint64 or not",
zap.Uint64("checkpointTs", preCheckpointTs),
zap.Uint64("resolvedTs", c.state.Status.ResolvedTs),
Expand All @@ -426,8 +426,6 @@ func (c *changefeed) tick(ctx cdcContext.Context, captures map[model.CaptureID]*
newCheckpointTs = barrier.minDDLBarrierTs
}

// If the table pipeline corresponding to minDDLBarrierTs is not ready, newCheckpointTs
// should wait for it.
// Note that newResolvedTs could be larger than barrier.GlobalBarrierTs no matter
// whether redo is enabled.
if newCheckpointTs > barrier.minDDLBarrierTs {
Expand Down Expand Up @@ -459,6 +457,9 @@ func (c *changefeed) tick(ctx cdcContext.Context, captures map[model.CaptureID]*
} else {
newResolvedTs = prevResolvedTs
}
// If allPhysicalTables is empty, newCheckpointTs would advance to min table barrier ts, which may be larger
// than preResolvedTs. In this case, we need to set newCheckpointTs to preResolvedTs to guarantee that the
// checkpointTs will not cross the preResolvedTs.
if newCheckpointTs > prevResolvedTs {
newCheckpointTs = prevResolvedTs
if newCheckpointTs < preCheckpointTs {
Expand Down

0 comments on commit 5cadf0c

Please sign in to comment.