diff --git a/lightning/pkg/importer/meta_manager.go b/lightning/pkg/importer/meta_manager.go index 188ecb9987507..d4fe9523b08e4 100644 --- a/lightning/pkg/importer/meta_manager.go +++ b/lightning/pkg/importer/meta_manager.go @@ -185,7 +185,7 @@ func (m *dbTableMetaMgr) AllocTableRowIDs(ctx context.Context, rawRowIDMax int64 //nolint: errcheck defer conn.Close() exec := &common.SQLWithRetry{ - DB: m.session, + DB: conn, Logger: m.tr.logger, } var newRowIDBase, newRowIDMax int64 @@ -391,7 +391,7 @@ func (m *dbTableMetaMgr) CheckAndUpdateLocalChecksum(ctx context.Context, checks //nolint: errcheck defer conn.Close() exec := &common.SQLWithRetry{ - DB: m.session, + DB: conn, Logger: m.tr.logger, } err = exec.Exec(ctx, "enable pessimistic transaction", "SET SESSION tidb_txn_mode = 'pessimistic';") @@ -664,7 +664,7 @@ func (m *dbTaskMetaMgr) CheckTasksExclusively(ctx context.Context, action func(t //nolint: errcheck defer conn.Close() exec := &common.SQLWithRetry{ - DB: m.session, + DB: conn, Logger: log.FromContext(ctx), } err = exec.Exec(ctx, "enable pessimistic transaction", "SET SESSION tidb_txn_mode = 'pessimistic';") @@ -735,7 +735,7 @@ func (m *dbTaskMetaMgr) CheckAndPausePdSchedulers(ctx context.Context) (pdutil.U //nolint: errcheck defer conn.Close() exec := &common.SQLWithRetry{ - DB: m.session, + DB: conn, Logger: log.FromContext(ctx), } err = exec.Exec(ctx, "enable pessimistic transaction", "SET SESSION tidb_txn_mode = 'pessimistic';") @@ -875,7 +875,7 @@ func (m *dbTaskMetaMgr) CheckAndFinishRestore(ctx context.Context, finished bool //nolint: errcheck defer conn.Close() exec := &common.SQLWithRetry{ - DB: m.session, + DB: conn, Logger: log.FromContext(ctx), } err = exec.Exec(ctx, "enable pessimistic transaction", "SET SESSION tidb_txn_mode = 'pessimistic';")