Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightning: reuse worker-concurr and remove range-concurr in local backend #43348

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions br/pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,7 @@ type BackendConfig struct {
MaxConnPerStore int
// compress type when write or ingest into tikv
ConnCompressType config.CompressionType
// concurrency of generateJobForRange.
RangeConcurrency int
// number of import(write & ingest) workers
// concurrency of generateJobForRange and import(write & ingest) workers
WorkerConcurrency int
KVWriteBatchSize int
CheckpointEnabled bool
Expand Down Expand Up @@ -427,7 +425,6 @@ func NewBackendConfig(cfg *config.Config, maxOpenFiles int, keyspaceName string)
LocalStoreDir: cfg.TikvImporter.SortedKVDir,
MaxConnPerStore: cfg.TikvImporter.RangeConcurrency,
ConnCompressType: cfg.TikvImporter.CompressKVPairs,
RangeConcurrency: cfg.TikvImporter.RangeConcurrency,
WorkerConcurrency: cfg.TikvImporter.RangeConcurrency * 2,
KVWriteBatchSize: cfg.TikvImporter.SendKVPairs,
CheckpointEnabled: cfg.Checkpoint.Enable,
Expand Down Expand Up @@ -1133,7 +1130,7 @@ func (local *Backend) generateAndSendJob(
logger.Debug("the ranges length write to tikv", zap.Int("length", len(jobRanges)))

eg, egCtx := errgroup.WithContext(ctx)
eg.SetLimit(local.RangeConcurrency)
eg.SetLimit(local.WorkerConcurrency)
for _, jobRange := range jobRanges {
r := jobRange
eg.Go(func() error {
Expand Down
3 changes: 1 addition & 2 deletions br/pkg/lightning/backend/local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ func TestSplitRangeAgain4BigRegion(t *testing.T) {
panicSplitRegionClient{}, // make sure no further split region
),
}
local.BackendConfig.RangeConcurrency = 1
local.BackendConfig.WorkerConcurrency = 1
db, tmpPath := makePebbleDB(t, nil)
_, engineUUID := backend.MakeUUID("ww", 0)
ctx := context.Background()
Expand Down Expand Up @@ -1598,7 +1598,6 @@ func TestDoImport(t *testing.T) {
ctx := context.Background()
l := &Backend{
BackendConfig: BackendConfig{
RangeConcurrency: 1,
WorkerConcurrency: 2,
},
}
Expand Down
1 change: 0 additions & 1 deletion executor/importer/table_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func NewTableImporter(param *JobImportParam, e *LoadDataController) (ti *TableIm
LocalStoreDir: dir,
MaxConnPerStore: config.DefaultRangeConcurrency,
ConnCompressType: config.CompressionNone,
RangeConcurrency: config.DefaultRangeConcurrency,
WorkerConcurrency: config.DefaultRangeConcurrency * 2,
KVWriteBatchSize: config.KVWriteBatchSize,
// todo: local backend report error when the sort-dir already exists & checkpoint disabled.
Expand Down