Skip to content

Commit

Permalink
planner: fix data race in the TestLongBinaryPlan (#39747)
Browse files Browse the repository at this point in the history
close #39746
  • Loading branch information
hawkingrei authored Dec 8, 2022
1 parent d9af2d1 commit 4ce3386
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions planner/core/binary_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,6 @@ func TestTooLongBinaryPlan(t *testing.T) {
// TestLongBinaryPlan asserts that if the binary plan is smaller than 1024*1024 bytes, it should be output to both slow query and stmt summary.
// The size of the binary plan in this test case is designed to be larger than 1024*1024*0.85 bytes but smaller than 1024*1024 bytes.
func TestLongBinaryPlan(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))

originCfg := config.GetGlobalConfig()
newCfg := *originCfg
f, err := os.CreateTemp("", "tidb-slow-*.log")
Expand All @@ -297,6 +293,10 @@ func TestLongBinaryPlan(t *testing.T) {
require.NoError(t, os.Remove(newCfg.Log.SlowQueryFile))
}()
require.NoError(t, logutil.InitLogger(newCfg.Log.ToLogConfig()))
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))

tk.MustExec(fmt.Sprintf("set @@tidb_slow_query_file='%v'", f.Name()))

tk.MustExec("use test")
Expand Down

0 comments on commit 4ce3386

Please sign in to comment.