help wantedsig/executiontype/enhancement
Description
Feature Request
Is your feature request related to a problem? Please describe:
The implementation of IndexMergeReader is rough now, we can refine it further to make the code more readable and correct.
Describe the feature you'd like:
- Remove the useless attribute
KeepOrderforIndexMergeReaderExecutor.IndexMergedoes not promise the output order and does not need the order of its children now, thus we do not need theKeepOrderattribute now. issue: https://github.com/pingcap/tidb/issues/14339 - Remove the attribute
indexMergeProcessWorker.maps, we can define this variable as a local variable inindexMergeProcessWorker.fetchLoop. issue: https://github.com/pingcap/tidb/issues/14339 - Refine the IPC between
partialWorkerandindexMergeProcessWorker.indexMergeProcessWorker.fetchLoopusepartialWorkerCnt--to check whether all thepartialWorkers finishing their work. We can use aWaitGroupto synchronize the work between all the partial workers, and start a goroutine which waits for the WaitGroup, and close thefetchChwhen all thepartialWorkers exit. WhenindexMergeProcessWorkerfails to fetch data fromfetchCh, it knows all thepartialWorkers exit. Refer this issue: https://github.com/pingcap/tidb/issues/14333 -
Runtime statsandfeedbackare not handled correctly duringindexMergeReaderExecutor, we need to make them work. https://github.com/pingcap/tidb/issues/14334 - We can use
WithRecoveryinstead of the way used to recover to make the code more readable. Refer this. issue: https://github.com/pingcap/tidb/issues/14335 - Start all the workers for the first time
Nextis called insteadOpen. issue: https://github.com/pingcap/tidb/issues/14336 - Send the result chk back to
indexMergeProcessWorkerto save the memory usage. Refer this issue: https://github.com/pingcap/tidb/issues/14337 - Send a batch of
handles to theindexMergeTableScanWorkers instead of the handles of a task which is filtered byindexMergeProcessWorker.maps. issue: https://github.com/pingcap/tidb/issues/14338