From 0fe2637137b5a83c59d2ad525960835d8f2624b5 Mon Sep 17 00:00:00 2001 From: TonsnakeLin <87681388+TonsnakeLin@users.noreply.github.com> Date: Mon, 20 Mar 2023 20:40:43 +0800 Subject: [PATCH] server: fix unstable test-case TestInternalSessionTxnStartTS (#42392) close pingcap/tidb#42269 --- executor/adapter.go | 13 ------------- server/tidb_test.go | 6 ------ 2 files changed, 19 deletions(-) diff --git a/executor/adapter.go b/executor/adapter.go index 4c4f227559aaa..e88d34b8236d4 100644 --- a/executor/adapter.go +++ b/executor/adapter.go @@ -553,19 +553,6 @@ func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error) { pi.SetProcessInfo(sql, time.Now(), cmd, maxExecutionTime) } - failpoint.Inject("mockDelayInnerSessionExecute", func() { - var curTxnStartTS uint64 - if cmd != mysql.ComSleep || sctx.GetSessionVars().InTxn() { - curTxnStartTS = sctx.GetSessionVars().TxnCtx.StartTS - } - if sctx.GetSessionVars().SnapshotTS != 0 { - curTxnStartTS = sctx.GetSessionVars().SnapshotTS - } - logutil.BgLogger().Info("Enable mockDelayInnerSessionExecute when execute statement", - zap.Uint64("startTS", curTxnStartTS)) - time.Sleep(200 * time.Millisecond) - }) - isPessimistic := sctx.GetSessionVars().TxnCtx.IsPessimistic // Special handle for "select for update statement" in pessimistic transaction. diff --git a/server/tidb_test.go b/server/tidb_test.go index 27f5284fc90bf..b51aa67ccd25c 100644 --- a/server/tidb_test.go +++ b/server/tidb_test.go @@ -903,7 +903,6 @@ func TestInternalSessionTxnStartTS(t *testing.T) { } // Test an issue that sysSessionPool doesn't call session's Close, cause // asyncGetTSWorker goroutine leak. - require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/executor/mockDelayInnerSessionExecute", "return")) var wg util.WaitGroupWrapper for i := 0; i < count; i++ { s := stmts[i] @@ -912,11 +911,6 @@ func TestInternalSessionTxnStartTS(t *testing.T) { require.NoError(t, err) }) } - time.Sleep(100 * time.Millisecond) - require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/executor/mockDelayInnerSessionExecute")) - - lst := ts.domain.InfoSyncer().GetSessionManager().GetInternalSessionStartTSList() - require.Equal(t, len(lst), 10) wg.Wait() }