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

added Pause option into minor compactions #5289

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ArbaazKhan1
Copy link
Contributor

Added a check in MinorCompactionTask to ensure that the current number of files being set to compact are below the Pause property threshold.

@kevinrr888 kevinrr888 linked an issue Jan 28, 2025 that may be closed by this pull request
@kevinrr888 kevinrr888 added this to the 4.0.0 milestone Jan 28, 2025
@@ -392,7 +393,13 @@ DataFileValue minorCompact(InMemoryMap memTable, ReferencedTabletFile tmpDatafil
Span span = TraceUtil.startSpan(this.getClass(), "minorCompact::write");
try (Scope scope = span.makeCurrent()) {
count = memTable.getNumEntries();

if (count > pauseLimit && pauseLimit > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want to pause minor compactions when the number of entries in tablet exceeds the file count pause property. We only want to pause minor compactions when the number of files in the tablet exceeds the file count pause property. I think that the change in this file can be removed.

currentFileCount); // Add pause check here
} catch (AcceptableThriftTableOperationException e) {
log.warn("Minor compaction paused due to file count for tablet {}", tablet.extent);
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that returning here will cause a minor compaction to be paused. I think the calling code will look at this as being completed successfully, right? I'm not sure this is the right solution. @keith-turner - what was your vision of this change from #5151 ?

Copy link
Contributor

@keith-turner keith-turner Feb 4, 2025

Choose a reason for hiding this comment

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

I would add the check here. If this code returns null then the minor compaction will never start. That code can consider the reason when making this decision. We could return null in the case where mincReason == SYSTEM and the tablets file count would exceed the limit. Probably do not want to prevent minor compactions for other reasons like log recovery or tablet close (tserver may have too many tablets and need to shed them). Returning null at that point in the code avoids putting anything on the thread pool and reserving things in the tablet memory (as long as prepareForMinC() is not called that is) that need to be properly unreserved in the case where it can not minor compact, so it seems like a good place to intercept.

There are some race conditions w/ the check at that location, the tablet could surge over the limit but would eventually pause in a stable system(one that is not migrating tablets). The bulk import code has the same behavior, it can surge over the limit but will eventually pause. Avoiding the race condition completely would require doing the minor compaction and checking the file count in the conditional mutation that adds the file to the tablet. This would be much more complex and not worth the effort IMO. Doing the check before queing the compaction is good even if there is race condition because the tablet will eventually pause and when it does it will keep pausing until the file count goes down providing the needed back pressure to keep the tablet healthy.

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.

Hold minor compactions when tablets files exceed pause limit
4 participants