From 587cb8b9016ab9436f227118bc1e8ec4443068cf Mon Sep 17 00:00:00 2001 From: ekexium Date: Tue, 2 Jul 2024 18:11:56 +0800 Subject: [PATCH 1/2] This is an automated cherry-pick of #53985 Signed-off-by: ti-chi-bot --- pkg/executor/delete.go | 5 ----- pkg/executor/insert_common.go | 5 ----- pkg/executor/replace.go | 5 ++++- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/pkg/executor/delete.go b/pkg/executor/delete.go index 3a70d190bae9e..50571625f4fed 100644 --- a/pkg/executor/delete.go +++ b/pkg/executor/delete.go @@ -150,11 +150,6 @@ func (e *DeleteExec) deleteSingleTableByChunk(ctx context.Context) error { } func (e *DeleteExec) doBatchDelete(ctx context.Context) error { - txn, err := e.Ctx().Txn(false) - if err != nil { - return exeerrors.ErrBatchInsertFail.GenWithStack("BatchDelete failed with error: %v", err) - } - e.memTracker.Consume(-int64(txn.Size())) e.Ctx().StmtCommit(ctx) if err := sessiontxn.NewTxnInStmt(ctx, e.Ctx()); err != nil { // We should return a special error for batch insert. diff --git a/pkg/executor/insert_common.go b/pkg/executor/insert_common.go index 1f1d7ff412f8d..3a80cf1963e9e 100644 --- a/pkg/executor/insert_common.go +++ b/pkg/executor/insert_common.go @@ -518,11 +518,6 @@ func insertRowsFromSelect(ctx context.Context, base insertCommon) error { } func (e *InsertValues) doBatchInsert(ctx context.Context) error { - txn, err := e.Ctx().Txn(false) - if err != nil { - return exeerrors.ErrBatchInsertFail.GenWithStack("BatchInsert failed with error: %v", err) - } - e.memTracker.Consume(-int64(txn.Size())) e.Ctx().StmtCommit(ctx) if err := sessiontxn.NewTxnInStmt(ctx, e.Ctx()); err != nil { // We should return a special error for batch insert. diff --git a/pkg/executor/replace.go b/pkg/executor/replace.go index 037cbc8b9ddcf..26f6090c30391 100644 --- a/pkg/executor/replace.go +++ b/pkg/executor/replace.go @@ -160,7 +160,6 @@ func (e *ReplaceExec) exec(ctx context.Context, newRows [][]types.Datum) error { if err != nil { return err } - txnSize := txn.Size() if e.collectRuntimeStatsEnabled() { if snapshot := txn.GetSnapshot(); snapshot != nil { @@ -186,8 +185,12 @@ func (e *ReplaceExec) exec(ctx context.Context, newRows [][]types.Datum) error { return err } } +<<<<<<< HEAD e.memTracker.Consume(int64(txn.Size() - txnSize)) return nil +======= + return txn.MayFlush() +>>>>>>> 9960ae746a3 (executor: do not track membuffer's memory in executor (#53985)) } // Next implements the Executor Next interface. From bcd6dc78f6aeca78cd349087bbd44691fef38ddc Mon Sep 17 00:00:00 2001 From: ekexium Date: Thu, 11 Jul 2024 16:42:58 +0800 Subject: [PATCH 2/2] fix conflict Signed-off-by: ekexium --- pkg/executor/replace.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkg/executor/replace.go b/pkg/executor/replace.go index 26f6090c30391..abbbe11082d19 100644 --- a/pkg/executor/replace.go +++ b/pkg/executor/replace.go @@ -185,12 +185,7 @@ func (e *ReplaceExec) exec(ctx context.Context, newRows [][]types.Datum) error { return err } } -<<<<<<< HEAD - e.memTracker.Consume(int64(txn.Size() - txnSize)) return nil -======= - return txn.MayFlush() ->>>>>>> 9960ae746a3 (executor: do not track membuffer's memory in executor (#53985)) } // Next implements the Executor Next interface.