Skip to content

Commit

Permalink
logSink: revert defaultBufferChanSize, add a trigger to flush logSink…
Browse files Browse the repository at this point in the history
….units when chennal is full (#2431) (#2446)
  • Loading branch information
ti-chi-bot authored Aug 3, 2021
1 parent 2c66164 commit a1976ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cdc/sink/cdclog/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ func (ts *tableStream) isEmpty() bool {
}

func (ts *tableStream) shouldFlush() bool {
return ts.sendSize.Load() > maxRowFileSize
// if sendSize > 5 MB or data chennal is full, flush it
return ts.sendSize.Load() > maxPartFlushSize || ts.sendEvents.Load() == defaultBufferChanSize
}

func (ts *tableStream) flush(ctx context.Context, sink *logSink) error {
Expand Down
5 changes: 3 additions & 2 deletions cdc/sink/cdclog/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
maxCompletePartSize = 100 << 20 // rotate row changed event file if one complete file larger than 100Mb
maxDDLFlushSize = 10 << 20 // rotate ddl event file if one complete file larger than 10Mb

defaultBufferChanSize = 1280000
defaultBufferChanSize = 20480
defaultFlushRowChangedEventDuration = 5 * time.Second // TODO make it as a config
)

Expand Down Expand Up @@ -78,7 +78,8 @@ func (tb *tableBuffer) isEmpty() bool {
}

func (tb *tableBuffer) shouldFlush() bool {
return tb.sendSize.Load() > maxPartFlushSize
// if sendSize > 5 MB or data chennal is full, flush it
return tb.sendSize.Load() > maxPartFlushSize || tb.sendEvents.Load() == defaultBufferChanSize
}

func (tb *tableBuffer) flush(ctx context.Context, sink *logSink) error {
Expand Down

0 comments on commit a1976ac

Please sign in to comment.