fix: handle nested low-level files in compaction#26911
fix: handle nested low-level files in compaction#26911davidby-influx merged 24 commits intomaster-1.xfrom
Conversation
Add `FileStore.SupportsCompactionPlanning()` which allows compaction planners to check if a `FileStore` supports compaction planning. Currently this means the `FileStore` must have a TSM filename parsing function available.
|
@devanbenz - please walk through The new tests start at the comment |
gwossum
left a comment
There was a problem hiding this comment.
It looks like it will solve the nested file issue and I can't find any new issues it introduces.
devanbenz
left a comment
There was a problem hiding this comment.
Just the one comment about tests. Overall this looks good to me. I ran the code locally and wrote out a few TSM files to disk using inch + influxd, afterwards when I had several files I went ahead and manually renamed the levels on them to have a nested and a leading level 2 file. It was captured by the compaction without issue.
Here is the files on disk as you can see I have nested lower level files:
-rw-r--r--@ 1 devan wheel 1492013 Oct 28 15:18 000000008-000000002.tsm
-rw-r--r--@ 1 devan wheel 1484013 Oct 28 15:18 000000016-000000002.tsm
-rw-r--r--@ 1 devan wheel 1327005 Oct 28 15:18 000000024-000000002.tsm
-rw-r--r--@ 1 devan wheel 284013 Oct 28 15:18 000000025-000000001.tsm
-rw-r--r--@ 1 devan wheel 284013 Oct 28 15:18 000000026-000000001.tsm
-rw-r--r--@ 1 devan wheel 284005 Oct 28 15:18 000000027-000000004.tsm
-rw-r--r--@ 1 devan wheel 284013 Oct 28 15:20 000000028-000000005.tsm
-rw-r--r--@ 1 devan wheel 21818009 Oct 28 15:32 000000159-000000004.tsm
-rw-r--r--@ 1 devan wheel 22375789 Oct 28 15:34 000000287-000000004.tsm
-rw-r--r--@ 1 devan wheel 22450341 Oct 28 15:36 000000415-000000004.tsm
-rw-r--r--@ 1 devan wheel 22396817 Oct 28 15:41 000000543-000000004.tsm
-rw-r--r--@ 1 devan wheel 5620965 Oct 28 15:42 000000575-000000003.tsm
-rw-r--r--@ 1 devan wheel 1431685 Oct 28 15:42 000000583-000000002.tsm
-rw-r--r--@ 1 devan wheel 1424133 Oct 28 15:42 000000591-000000002.tsm
-rw-r--r--@ 1 devan wheel 1424321 Oct 28 15:42 000000599-000000002.tsm
-rw-r--r--@ 1 devan wheel 90985 Oct 28 15:42 000000600-000000001.tsm
After letting influxd sit for a bit after modifying the cold write duration (~5 minutes)
-rw-r--r--@ 1 devan wheel 93835106 Oct 28 16:12 000000543-000000005.tsm
-rw-r--r--@ 1 devan wheel 22415417 Oct 28 16:02 000000672-000000004.tsm
-rw-r--r--@ 1 devan wheel 22290681 Oct 28 16:04 000000800-000000004.tsm
-rw-r--r--@ 1 devan wheel 1424521 Oct 28 16:04 000000808-000000002.tsm
-rw-r--r--@ 1 devan wheel 1417977 Oct 28 16:04 000000816-000000002.tsm
-rw-r--r--@ 1 devan wheel 1414785 Oct 28 16:05 000000824-000000002.tsm
-rw-r--r--@ 1 devan wheel 180693 Oct 28 16:05 000000825-000000001.tsm
-rw-r--r--@ 1 devan wheel 182217 Oct 28 16:05 000000826-000000001.tsm
-rw-r--r--@ 1 devan wheel 182793 Oct 28 16:05 000000827-000000001.tsm
-rw-r--r--@ 1 devan wheel 181793 Oct 28 16:05 000000828-000000001.tsm
-rw-r--r--@ 1 devan wheel 135033 Oct 28 16:05 000000829-000000001.tsm
The lower level nested files are picked up and everything seems good.
| }, | ||
| }, | ||
| { | ||
| name: "Mixed generations with 3 level 2 files", |
There was a problem hiding this comment.
Can you add an additional test similar to this one with 3 level 3 files?
502ed65
Simplify and refactor compaction planner to handle low-level files occurring before higher-level (more compacted) files. (cherry picked from commit a099cb7)
Simplify and refactor compaction planner to handle low-level files occurring before higher-level (more compacted) files. (cherry picked from commit a099cb7) Co-authored-by: davidby-influx <72418212+davidby-influx@users.noreply.github.com>
Previously, when a lower-level file (level 1, 2, or 3) was in between level 4 or higher files, it would not be compacted, and it would prevent full compactions from running.
This fix allows lower level files to be compacted even if sandwiched in between higher level files or as the first/earliest file in a shard.
Exampe problem from a customer system:
There is a rogue level 2 file packed within fully compacted files