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

perf: avoid arrow IPC & unneeded steps when flushing delta #247

Merged
merged 8 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion binlogreplication/binlog_replica_applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,14 +1245,18 @@ func (a *binlogReplicaApplier) appendRowFormatChanges(
}

func (a *binlogReplicaApplier) flushDeltaBuffer(ctx *sql.Context, reason delta.FlushReason) error {
conn, err := adapter.GetConn(ctx)
if err != nil {
return err
}
tx, err := adapter.GetCatalogTxn(ctx, nil)
if err != nil {
return err
}

defer a.deltaBufSize.Store(0)

if err = a.tableWriterProvider.FlushDeltaBuffer(ctx, tx, reason); err != nil {
if err = a.tableWriterProvider.FlushDeltaBuffer(ctx, conn, tx, reason); err != nil {
ctx.GetLogger().Errorf("Failed to flush changelog: %v", err.Error())
MyBinlogReplicaController.setSqlError(sqlerror.ERUnknownError, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion binlogreplication/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type TableWriterProvider interface {
) (DeltaAppender, error)

// FlushDelta writes the accumulated changes to the database.
FlushDeltaBuffer(ctx *sql.Context, tx *stdsql.Tx, reason delta.FlushReason) error
FlushDeltaBuffer(ctx *sql.Context, conn *stdsql.Conn, tx *stdsql.Tx, reason delta.FlushReason) error

// DiscardDeltaBuffer discards the accumulated changes.
DiscardDeltaBuffer(ctx *sql.Context)
Expand Down
Loading
Loading