Skip to content

[IOTDB-5147]Optimize compaction schedule when priority is BALANCE#9103

Merged
xingtanzjr merged 4 commits intoapache:masterfrom
choubenson:CompactionComparator
Feb 24, 2023
Merged

[IOTDB-5147]Optimize compaction schedule when priority is BALANCE#9103
xingtanzjr merged 4 commits intoapache:masterfrom
choubenson:CompactionComparator

Conversation

@choubenson
Copy link
Contributor

@choubenson choubenson commented Feb 20, 2023

The changes in this pr are as follows:

  1. Change the size of the candidateCompactionTaskQueue from 1000 to 50. The advantage is to avoid tasks blocked in the queue occupying files for a long time, resulting in no files being selected for cross-space compaction. But another impact is that once the number of files is large, because the number of tasks in the queue shrinks, the inner-space compaction will not be able to compact the latest files.
  2. Priority comparison of tasks: Inner-space compaction tasks no longer distinguish between seq and unseq, but are sorted according to unified rules; under the configuration of BALANCE, cross-space compaction tasks and inner-space compaction tasks follow the first-come-first-executed rule . One thing to note is that since the priority sorting of the queue is implemented through the minimum heap sorting, and each task is not in partial order, the actual result is not strictly that the one with the smaller seriesID will be executed first.

// submit a merge task even it does not meet the requirement for file num or file size
if (hasNextTimePartition && selectedFileList.size() > 1) {
taskPriorityQueue.add(new Pair<>(new ArrayList<>(selectedFileList), selectedFileSize));
addOneTaskToQueue(taskPriorityQueue, selectedFileList, selectedFileSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value is not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unnecessary to use return value of addOneTaskToQueue here, because no matter what it is, selectLevelTask method will return false here.

private boolean enableCompactionValidation = true;

/** The number of candidate compaction task queue. */
private int candidateCompactionTaskQueueSize = 50;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This param is appeared in IoTDBConfig but not in iotdb-common.properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved.

@xingtanzjr
Copy link
Contributor

Let's complete the verification of BALANCE for inner compaction between seq and unseq by Benchmark with 50% out-of-order data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants