Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
GMHDBJD committed Jan 26, 2022
1 parent c9a821c commit 5afac75
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dm/syncer/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var (
globalCpSchema = "" // global checkpoint's cp_schema
globalCpTable = "" // global checkpoint's cp_table
maxCheckPointTimeout = "1m"
batchFlushPoints = 100
)

type tablePoint struct {
Expand Down Expand Up @@ -722,16 +723,15 @@ func (cp *RemoteCheckPoint) FlushPointsWithTableInfos(tctx *tcontext.Context, ta
return errors.Errorf("the length of the tables is not equal to the length of the table infos, left: %d, right: %d", len(tables), len(tis))
}

batch := 100
for i := 0; i < len(tables); i += batch {
end := i + batch
for i := 0; i < len(tables); i += batchFlushPoints {
end := i + batchFlushPoints
if end > len(tables) {
end = len(tables)
}

sqls := make([]string, 0, batch)
args := make([][]interface{}, 0, batch)
points := make([]*binlogPoint, 0, batch)
sqls := make([]string, 0, batchFlushPoints)
args := make([][]interface{}, 0, batchFlushPoints)
points := make([]*binlogPoint, 0, batchFlushPoints)
for j := i; j < end; j++ {
table := tables[j]
ti := tis[j]
Expand Down

0 comments on commit 5afac75

Please sign in to comment.