diff --git a/pkg/executor/delete.go b/pkg/executor/delete.go index 6ec0b696a9c0b..40b441c624dfc 100644 --- a/pkg/executor/delete.go +++ b/pkg/executor/delete.go @@ -156,11 +156,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 185882b3065c7..4a391e2321466 100644 --- a/pkg/executor/insert_common.go +++ b/pkg/executor/insert_common.go @@ -521,11 +521,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 bc9a5d7447f82..e52dc608343bd 100644 --- a/pkg/executor/replace.go +++ b/pkg/executor/replace.go @@ -161,7 +161,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 { @@ -187,7 +186,6 @@ func (e *ReplaceExec) exec(ctx context.Context, newRows [][]types.Datum) error { return err } } - e.memTracker.Consume(int64(txn.Size() - txnSize)) return txn.MayFlush() }