-
Notifications
You must be signed in to change notification settings - Fork 22
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
Allow custom SAI components discovery #1338
base: main
Are you sure you want to change the base?
Conversation
e19c101
to
dacb203
Compare
32f9a1b
to
362bf10
Compare
6f1346d
to
2961010
Compare
private volatile boolean isComplete; | ||
// Mark groups that are being read/have been fully written, and thus should not have new components added. | ||
// This is just to catch errors where we'd try to add a component after the completion marker was written. | ||
private volatile boolean sealed; |
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.
is "sealed" a reserved keyword in some newer java version ?
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.
Yes and no. It's a "contextual reserved keyword" in java 16+ but this is not a context where it is reserved (it's only in class/interface names).
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.
LGTM
9b22677
to
16b0adc
Compare
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.
LGTM
boolean isUsable = candidate.expectedComponentsForVersion().stream().noneMatch(candidate::componentExistsOnDisk); | ||
if (!isUsable) | ||
{ | ||
noSpamLogger.warn(logMessage("Wanted to use generation {} for new build of {} SAI components of {}, but found some existing components on disk for that generation (maybe leftover from an incomplete/corrupted build?); trying next generation"), |
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.
nit: would be nice to include sstable id in the log
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.
Unless I misunderstand what you mean by "sstable id", I believe it's in there already: the last arg of the message is descriptor
which is the sstable Descriptor
and thus includes the id.
src/java/org/apache/cassandra/index/sai/disk/format/IndexDescriptor.java
Outdated
Show resolved
Hide resolved
Refactor the code that "discover" which SAI components files an SSTable has to allow making that code customizable. The default behavior remains the existing one, that is the TOC file is consulted, with a fallback to scanning disk if the TOC file is missing or corrupted. The way to customize this behavior is similar to what `SSTableWatcher` does: a new system property, `-Dcassandra.sai.custom_components_discovery_class` allows to load a specific class (that extends the `IndexCoomponentDiscovery` class) instead of the default. As part of the refactor to make this new customisability easier, this introduces a new `ComponentsBuildId` class that is the pair of the version and generation of a group of components, since this is what ultimately defines a given component "group" build.
It's easy to do so, and easier for implementation of that callback if they need it (they could get it indirectly from the sstable descriptor keyspace and table name, but passing it is easier).
16b0adc
to
e3a70a8
Compare
Quality Gate passedIssues Measures |
❌ Build ds-cassandra-pr-gate/PR-1338 rejected by Butler1 new test failure(s) in 4 builds Found 1 new test failures
Found 14 known test failures |
Refactor the code that "discover" which SAI components files an SSTable has to allow making that code customizable. The default behavior remains the existing one, that is the TOC file is consulted, with a fallback to scanning disk if the TOC file is missing or corrupted.
The way to customize this behavior is similar to what
SSTableWatcher
does: a new system property,-Dcassandra.sai.custom_components_discovery_class
allows to load a specific class (that extends theIndexCoomponentDiscovery
class) instead of the default.As part of the refactor to make this new customisability easier, this introduces a new
ComponentsBuildId
class that is the pair of the version and generation of a group of components, since this is whatultimately defines a given component "group" build.This PR is used by https://github.com/riptano/cndb/pull/11361 on the CNDB side, in the context of https://github.com/riptano/cndb/issues/10889.