Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logSink: revert defaultBufferChanSize, add a trigger to flush logSink.units when chennal is full (#2431) #2444

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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