Skip to content

Updates DefaultCompactionPlanner to honor table.file.max prop#4127

Merged
keith-turner merged 4 commits intoapache:2.1from
keith-turner:table-file-max-dcs
Jan 5, 2024
Merged

Updates DefaultCompactionPlanner to honor table.file.max prop#4127
keith-turner merged 4 commits intoapache:2.1from
keith-turner:table-file-max-dcs

Conversation

@keith-turner
Copy link
Copy Markdown
Contributor

This change updates the DefaultCompactionPlanner to honor the table.file.max property. When a tablet has more files than is configured in table.file.max and its not compacting, it will try to find a compaction ratio that will cause a compaction.

Using a lower compaction ratio will find files of a similar size to compact. This avoids the problem with deprecated DefautlCompactionStrategy where it may select a 1K and 1G file for compaction because it selected the N smallest files that would bring the tablet under the table.file.max limit.

This change updates the DefaultCompactionPlanner to honor the
table.file.max property.  When a tablet has more files than is
configured in table.file.max and its not compacting, it will try to
find a compaction ratio that will cause a compaction.

Using a lower compaction ratio will find files of a similar size to
compact. This avoids the problem with deprecated DefautlCompactionStrategy
where it may select a 1K and 1G file for compaction because it selected
the N smallest files that would bring the tablet under the
table.file.max limit.
maxTabletFiles);
}

log.trace(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This may be better if logged at info, maybe even warn?

The case for info would be to make sure it is showing up in the logs so that it can be traced why the compactions are occurring when they do not meet the configured compaction ration.

The case for warn to would be to call attention that the current compaction configuration may not be adequate - maybe they would want to raise the number of files, increase the allowed file size, or something else?

Copy link
Copy Markdown
Contributor Author

@keith-turner keith-turner Jan 3, 2024

Choose a reason for hiding this comment

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

This may be better if logged at info, maybe even warn?

I kept going back and forth on what to log this at. I did have it at debug, then switched it trace. It probably should be debug, info, or warn. I suppose if its too chatty we could consider modifying it then.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed it to info. Was thinking warn suited the case where its above table.file.max and nothing is being found.

Comment on lines +112 to +121
* <p>
* Starting with Accumulo 2.1.3, this plugin will use the table config option
* {@code "table.file.max"}. When a tablet has no compactions running, its number of files exceeds
* table.file.max, and system compactions are not finding anything to compact then this plugin will
* try to find a lower compaction ratio that will result in a compaction. For example if the
* compaction ratio is set to 3, a tablet has 20 files, table.file.max is 15 and no compactions are
* planned, then this plugin will find the largest compaction ratio less than 3 that results in a
* compaction.
* </p>
*
Copy link
Copy Markdown
Contributor

@ddanielr ddanielr Jan 3, 2024

Choose a reason for hiding this comment

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

The wording is a bit awkward, suggest changing it to make the criteria clearer.
This is a rough draft suggestion. I'd recommend changing formatting as needed.

Suggested change
* <p>
* Starting with Accumulo 2.1.3, this plugin will use the table config option
* {@code "table.file.max"}. When a tablet has no compactions running, its number of files exceeds
* table.file.max, and system compactions are not finding anything to compact then this plugin will
* try to find a lower compaction ratio that will result in a compaction. For example if the
* compaction ratio is set to 3, a tablet has 20 files, table.file.max is 15 and no compactions are
* planned, then this plugin will find the largest compaction ratio less than 3 that results in a
* compaction.
* </p>
*
* <p>
* Starting with Accumulo 2.1.3, this plugin will use the table config option
* {@code "table.file.max"}.
* When the following three conditions are met, then this plugin will try to find a lower compaction ratio that will result in a compaction:
* 1. When a tablet has no compactions running
* 2. Its number of files exceed table.file.max
* 3. System compactions are not finding anything to compact.
* For example, given a tablet with 20 files, and table.file.max is 15 and no compactions are planned. If the compaction ratio is set to 3, then this plugin will find the largest compaction ratio less than 3 that results in a
* compaction.
* </p>
*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thats easier to understand. I updated the javadoc, made it use HTML for the list and added a 4th condition that the code was checking for.

Copy link
Copy Markdown
Contributor

@ddanielr ddanielr left a comment

Choose a reason for hiding this comment

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

Minor suggestion about documentation restructuring but overall these changes look good.

Since this PR does change compactions, should this change be included in 2.1.3 or should it wait for 2.1.4?

@keith-turner keith-turner merged commit 08628c0 into apache:2.1 Jan 5, 2024
@keith-turner keith-turner deleted the table-file-max-dcs branch January 5, 2024 00:38
cshannon added a commit to cshannon/accumulo that referenced this pull request Jan 7, 2024
This increases the value of table.file.max.prop to 1001, which is the
value already used by testErrorDuringUserCompaction, so that the tests
get the expected values
@cshannon
Copy link
Copy Markdown
Contributor

cshannon commented Jan 7, 2024

This looks like it has caused a couple test failures in 2.1 and main for CompactionIT because table.file.max.prop is set too low for the test (I guess that's a good thing since it means this is working). I created a PR that fixes this: #4134

keith-turner pushed a commit that referenced this pull request Jan 8, 2024
This increases the value of table.file.max.prop to 1001, which is the
value already used by testErrorDuringUserCompaction, so that the tests
get the expected values
@ctubbsii ctubbsii modified the milestones: 3.1.0, 2.1.3 Jul 12, 2024
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.

5 participants