Skip to content

Commit

Permalink
ddl: fix data race in TestTiFlashBatchRateLimiter (#33006)
Browse files Browse the repository at this point in the history
close #33005
  • Loading branch information
CalvinNeo authored Mar 14, 2022
1 parent f0238dd commit dd94777
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ddl/ddl_tiflash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"fmt"
"math"
"sync"
"sync/atomic"
"testing"
"time"
Expand Down Expand Up @@ -887,12 +888,17 @@ func TestTiFlashBatchRateLimiter(t *testing.T) {

// Retrigger, but close session before the whole job ends.
var wg util.WaitGroupWrapper
var mu sync.Mutex
wg.Run(func() {
time.Sleep(time.Millisecond * 20)
mu.Lock()
defer mu.Unlock()
tk.Session().Close()
logutil.BgLogger().Info("session closed")
})
mu.Lock()
timeOut, err = execWithTimeout(t, tk, time.Second*2, "alter database tiflash_ddl_limit set tiflash replica 1")
mu.Unlock()
require.NoError(t, err)
require.False(t, timeOut)
check(5, 5)
Expand Down

0 comments on commit dd94777

Please sign in to comment.