Skip to content

Commit

Permalink
importinto: fix data race in test (#47965)
Browse files Browse the repository at this point in the history
close #47776
  • Loading branch information
D3Hunter committed Oct 26, 2023
1 parent 3a3a7d1 commit a7366f9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion br/pkg/lightning/mydump/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,8 @@ func calculateFileBytes(ctx context.Context,
}
defer reader.Close()

compressReader, err := storage.NewLimitedInterceptReader(reader, compressType, storage.DecompressConfig{}, offset)
decompressConfig := storage.DecompressConfig{ZStdDecodeConcurrency: 1}
compressReader, err := storage.NewLimitedInterceptReader(reader, compressType, decompressConfig, offset)
if err != nil {
return 0, 0, errors.Trace(err)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/disttask/framework/dispatcher/dispatcher_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func NewManager(ctx context.Context, taskMgr TaskManager, serverID string) (*Man

// Start the dispatcherManager, start the dispatchTaskLoop to start multiple dispatchers.
func (dm *Manager) Start() {
failpoint.Inject("disableDispatcherManager", func() {
failpoint.Return()
})
dm.wg.Run(dm.dispatchTaskLoop)
dm.wg.Run(dm.gcSubtaskHistoryTableLoop)
dm.wg.Run(dm.cleanUpLoop)
Expand Down
6 changes: 6 additions & 0 deletions pkg/disttask/importinto/dispatcher_testkit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ func TestDispatcherExtLocalSort(t *testing.T) {
}

func TestDispatcherExtGlobalSort(t *testing.T) {
// Domain start dispatcher manager automatically, we need to disable it as
// we test import task management in this case.
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/disttask/framework/dispatcher/disableDispatcherManager", "return(true)"))
t.Cleanup(func() {
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/disttask/framework/dispatcher/disableDispatcherManager"))
})
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
pool := pools.NewResourcePool(func() (pools.Resource, error) {
Expand Down

0 comments on commit a7366f9

Please sign in to comment.