-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Implement a fingerprinting mechanism to track compaction states in a more efficient manner #18844
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
Merged
capistrant
merged 76 commits into
apache:master
from
capistrant:compaction-fingerprinting
Jan 21, 2026
Merged
Changes from 17 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
d8490b0
meatadata store bits part 1
capistrant 3d2d423
annotate segments with compaction fingerprint before persist
capistrant 48854f4
Add ability to generate compaction state fingerprint
capistrant c6a3367
add fingerprint to task context and make legacy last compaction state…
capistrant f3b706e
update embedded tests for compaction supervisors to flex fingerprints
capistrant 46fb807
checkpoint with persisting compaction states
capistrant 0fef358
add duty to clean up unused compaction states
capistrant edeaf30
take fingerprints into account in CompactionStatus
capistrant 97daf3f
Add and improve tests
capistrant dbcdfcf
get rid of some todo comments
capistrant 38f6d15
fix checkstyle
capistrant 4cf1197
cleanup some more TODO
capistrant ba269bd
Add some docs
capistrant f168bc9
update web console
capistrant 2292b15
make cache size configurable and fix some spelling
capistrant 74c8ebc
fixup use of deprecated builder
capistrant adac5ec
fix checktyle
capistrant 4fb3a9c
fix coordinator compactsegments duty and respond to self review comments
capistrant 708c6f8
fix spellchecker
capistrant 03bb14a
predates is a word
capistrant a262f79
improve some javadocs
capistrant 6126e22
simplify some test assertions based on review
capistrant b78ec13
better naming
capistrant 78f115e
controller impl cleanup
capistrant f06d715
For compaction supervisors, take persisting pending compaction states…
capistrant d571e43
use Configs.valueOrDefault helper in data segment
capistrant 07afc2f
Refactor where fingerprinting happens and how the object mapper is wi…
capistrant 12ea741
refactor CompactionStateManager into an interface with a persisted an…
capistrant f57527a
Merge branch 'master' into compaction-fingerprinting
capistrant 858cbd3
remove fingerprinting support from the coordinator compact segments duty
capistrant 9afab2f
Move on heap compaction state manager to test sources
capistrant 34a8a11
CompactionStateManager is now overlord only
capistrant 7214418
Refactor how the compaction state fingerprint cache is wired up
capistrant 6a9743a
Merge branch 'master' into compaction-fingerprinting
capistrant cd55b0e
prettify
capistrant 58724cc
small changes after self-review
capistrant 0c1c6ed
Cleanup CompactionStateCache per review
capistrant 6bd1875
compactionstatemanager to compactionstatestorage plus refactor
capistrant 79e3a54
Add compaction state added and deleted metrics
capistrant 6e23adc
improve queries for compaction state cache sync
capistrant 58149e6
clean up doc wording
capistrant b5568d2
Miscl. cleanup from review
capistrant 0fab9f9
some metadata store code cleanup
capistrant 6f40f9f
refactor id out of the compaction states table as it is superflous
capistrant 8713760
Some CompactionStatus cleanup
capistrant a4bf6c8
Migrate the location of creating a compaction state from config
capistrant 21a10e6
More refactoring per review
capistrant 5ffb59e
refactor to remove duplicate fingerprint generator code
capistrant 0c38c76
Do some consolidation of fingerprint related classes to clean up code
capistrant f62e2ea
minor cleanup
capistrant c81f242
fix fobidden api use
capistrant ed2c06c
Improvements and cleanup to the fingerprint and state persist + cache
capistrant f0632f9
Refactor where in the code compaction fingerprints are generated
capistrant b081727
Formalize unique constraint exception check in sqlmetadataconnector a…
capistrant 0103d8e
some naming cleanup
capistrant 7aefe38
Migrate the compaction state cleanup duty to the overlord
capistrant 5c4fd98
Blow up the compaction supervisor scheduler if incremental caching is…
capistrant 74cb69b
add some strict input sanitization in upserting compaction fingerprints
capistrant fa72c38
cleanup test class
capistrant c467a39
Add pending flag to compaction state to prevent potentially destructi…
capistrant 79ac0c5
Refactor database naming to use indexingState instead of compactionState
capistrant 0d7c73f
Refactor naming to IndexingState for the metadata cleanup duty
capistrant d5105f3
refresh some docs
capistrant 5793cb0
fixup tests
capistrant f87f99f
Refactoring name of CompactionStateCache to IndexingStateCache
capistrant 5af3a5b
Rename CompactionStateStorage to IndexingStateStorage
capistrant acde92b
Refactor compactionStateFingerprint out of the code in favor of index…
capistrant 5c2050c
Refactor FingerprintMapper name to remove compaction for indexing state
capistrant ff2949f
refactorings after self review
capistrant 389e8da
Merge branch 'master' into compaction-fingerprinting
capistrant c034d05
fixup a few things post merge with master
capistrant 3c2ed1a
Merge branch 'master' into compaction-fingerprinting
capistrant 0cdbb37
Cleanup and refactor after code review round
capistrant 7768a8a
cleanup
capistrant ec668a8
use effective state for dimspec and indexspec for reindexing fingerpr…
capistrant e582667
Only call into running checks if there are unknown states to check
capistrant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,7 @@ | |||||
| import org.apache.druid.server.coordinator.InlineSchemaDataSourceCompactionConfig; | ||||||
| import org.apache.druid.server.coordinator.UserCompactionTaskGranularityConfig; | ||||||
| import org.apache.druid.server.coordinator.UserCompactionTaskQueryTuningConfig; | ||||||
| import org.apache.druid.server.coordinator.duty.CompactSegments; | ||||||
| import org.apache.druid.testing.embedded.EmbeddedBroker; | ||||||
| import org.apache.druid.testing.embedded.EmbeddedCoordinator; | ||||||
| import org.apache.druid.testing.embedded.EmbeddedDruidCluster; | ||||||
|
|
@@ -50,6 +51,7 @@ | |||||
| import org.apache.druid.testing.embedded.EmbeddedRouter; | ||||||
| import org.apache.druid.testing.embedded.indexing.MoreResources; | ||||||
| import org.apache.druid.testing.embedded.junit5.EmbeddedClusterTestBase; | ||||||
| import org.apache.druid.timeline.CompactionState; | ||||||
| import org.hamcrest.Matcher; | ||||||
| import org.hamcrest.Matchers; | ||||||
| import org.joda.time.Period; | ||||||
|
|
@@ -111,14 +113,14 @@ public EmbeddedDruidCluster createCluster() | |||||
| private void configureCompaction(CompactionEngine compactionEngine) | ||||||
| { | ||||||
| final UpdateResponse updateResponse = cluster.callApi().onLeaderOverlord( | ||||||
| o -> o.updateClusterCompactionConfig(new ClusterCompactionConfig(1.0, 100, null, true, compactionEngine)) | ||||||
| o -> o.updateClusterCompactionConfig(new ClusterCompactionConfig(1.0, 100, null, true, compactionEngine, true)) | ||||||
| ); | ||||||
| Assertions.assertTrue(updateResponse.isSuccess()); | ||||||
| } | ||||||
|
|
||||||
| @MethodSource("getEngine") | ||||||
| @ParameterizedTest(name = "compactionEngine={0}") | ||||||
| public void test_ingestDayGranularity_andCompactToMonthGranularity_withInlineConfig(CompactionEngine compactionEngine) | ||||||
| public void test_ingestDayGranularity_andCompactToMonthGranularity_andCompactToYearGranularity_withInlineConfig(CompactionEngine compactionEngine) | ||||||
| { | ||||||
| configureCompaction(compactionEngine); | ||||||
|
|
||||||
|
|
@@ -132,7 +134,7 @@ public void test_ingestDayGranularity_andCompactToMonthGranularity_withInlineCon | |||||
| Assertions.assertEquals(3, getNumSegmentsWith(Granularities.DAY)); | ||||||
|
|
||||||
| // Create a compaction config with MONTH granularity | ||||||
| InlineSchemaDataSourceCompactionConfig compactionConfig = | ||||||
| InlineSchemaDataSourceCompactionConfig monthGranConfig = | ||||||
|
||||||
| InlineSchemaDataSourceCompactionConfig monthGranConfig = | |
| InlineSchemaDataSourceCompactionConfig monthGranularityConfig = |
Outdated
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 assertions can be omitted, just the last one should suffice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.