-
Notifications
You must be signed in to change notification settings - Fork 21
CNDB-15141: add LogTransaction#validate API to perform validation before txn prepare #2008
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
Conversation
Checklist before you submit for review
|
6757397
to
db0d670
Compare
d34a49c
to
0033493
Compare
return; | ||
|
||
// Early-open modifies obsolete SSTables' start keys, making validation unreliable | ||
if (DatabaseDescriptor.getSSTablePreemptiveOpenIntervalInMB() > 0) |
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.
Outside of CNDB this is a very significant limitation as the database is expected to always run with early open enabled. Would it work to look at the matching entry for inputs in the CANONICAL sstable set?
(If not, we need to issue a warning somewhere when the combination of these two options is set.)
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.
Good point, I think it's possible to get the original sstables with original start position from LifecycleTransaction
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.
pushed e96829ba514609e3ca4cf3e4361bedb962cca284 to use the original sstables instead of logged.obsolete
which are modified by early-open
021d5f8
to
8a98d05
Compare
/** | ||
* Whether to enable compaction validation to detect potential data loss and abort compaction | ||
*/ | ||
COMPACTION_VALIDATION_ENABLED("cassandra.compaction_validation_enabled", "true"), |
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.
Do we want this to be turned on by default everywhere? And do we want it in non-abort mode?
Related to this, I would change the flag to be an enum (e.g NONE/WARN/ABORT) to make the configuration cleaner.
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.
Pushed 3ab5de9f134 to change config to enum (NONE/WARN/ABORT).
For CC, the default is NONE.
For CNDB side, it would be ABORT for compactor and NONE for all other services.
wdyt?
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.
can you review cndb PR? https://github.com/riptano/cndb/pull/15431
b5d44cf
to
3ab5de9
Compare
…erlapping info for validation
3ab5de9
to
c114914
Compare
|
✔️ Build ds-cassandra-pr-gate/PR-2008 approved by ButlerApproved by Butler |
…lidation before txn prepare (#2008) riptano/cndb#15141 Added compaction task verification before transaction commit to validate if all source sstables' min/max keys are present in output sstables or expired if missing from output sstables. This is mainly to detect data loss caused by compaction strategy skipping some subranges of source sstables HCD-130. It works as following: 1. Extract all boundary keys (min/max) from source sstable 2. Check if boundary keys exist in output sstables a If all present, validation passes b. If any keys are missing, continue validation 3. For missing keys, read partition data from source sstables 4. Apply tombstone purging by using `gc_grace_seconds=0` 5. Check purged content a If there is no live data, validation passes. Keys are properly obsoleted b If there is live data, validation fails and throws to abort compaction if it's configured to abort Configs: * `cassandra.compaction_validation_mode=NONE`, available options: NONE/WARN/ABORT
…lidation before txn prepare (#2008) riptano/cndb#15141 Added compaction task verification before transaction commit to validate if all source sstables' min/max keys are present in output sstables or expired if missing from output sstables. This is mainly to detect data loss caused by compaction strategy skipping some subranges of source sstables HCD-130. It works as following: 1. Extract all boundary keys (min/max) from source sstable 2. Check if boundary keys exist in output sstables a If all present, validation passes b. If any keys are missing, continue validation 3. For missing keys, read partition data from source sstables 4. Apply tombstone purging by using `gc_grace_seconds=0` 5. Check purged content a If there is no live data, validation passes. Keys are properly obsoleted b If there is live data, validation fails and throws to abort compaction if it's configured to abort Configs: * `cassandra.compaction_validation_mode=NONE`, available options: NONE/WARN/ABORT
…lidation before txn prepare (#2008) riptano/cndb#15141 Added compaction task verification before transaction commit to validate if all source sstables' min/max keys are present in output sstables or expired if missing from output sstables. This is mainly to detect data loss caused by compaction strategy skipping some subranges of source sstables HCD-130. It works as following: 1. Extract all boundary keys (min/max) from source sstable 2. Check if boundary keys exist in output sstables a If all present, validation passes b. If any keys are missing, continue validation 3. For missing keys, read partition data from source sstables 4. Apply tombstone purging by using `gc_grace_seconds=0` 5. Check purged content a If there is no live data, validation passes. Keys are properly obsoleted b If there is live data, validation fails and throws to abort compaction if it's configured to abort Configs: * `cassandra.compaction_validation_mode=NONE`, available options: NONE/WARN/ABORT
…lidation before txn prepare (#2008) riptano/cndb#15141 Added compaction task verification before transaction commit to validate if all source sstables' min/max keys are present in output sstables or expired if missing from output sstables. This is mainly to detect data loss caused by compaction strategy skipping some subranges of source sstables HCD-130. It works as following: 1. Extract all boundary keys (min/max) from source sstable 2. Check if boundary keys exist in output sstables a If all present, validation passes b. If any keys are missing, continue validation 3. For missing keys, read partition data from source sstables 4. Apply tombstone purging by using `gc_grace_seconds=0` 5. Check purged content a If there is no live data, validation passes. Keys are properly obsoleted b If there is live data, validation fails and throws to abort compaction if it's configured to abort Configs: * `cassandra.compaction_validation_mode=NONE`, available options: NONE/WARN/ABORT
…lidation before txn prepare (#2008) riptano/cndb#15141 Added compaction task verification before transaction commit to validate if all source sstables' min/max keys are present in output sstables or expired if missing from output sstables. This is mainly to detect data loss caused by compaction strategy skipping some subranges of source sstables HCD-130. It works as following: 1. Extract all boundary keys (min/max) from source sstable 2. Check if boundary keys exist in output sstables a If all present, validation passes b. If any keys are missing, continue validation 3. For missing keys, read partition data from source sstables 4. Apply tombstone purging by using `gc_grace_seconds=0` 5. Check purged content a If there is no live data, validation passes. Keys are properly obsoleted b If there is live data, validation fails and throws to abort compaction if it's configured to abort Configs: * `cassandra.compaction_validation_mode=NONE`, available options: NONE/WARN/ABORT
What is the issue
https://github.com/riptano/cndb/issues/15141
What does this PR fix and why was it fixed
Added compaction task verification before transaction commit to validate if all source sstables' min/max keys are present in output sstables or expired if missing from output sstables.
This is mainly to detect data loss caused by compaction strategy skipping some subranges of source sstables HCD-130.
It works as following:
a If all present, validation passes
b. If any keys are missing, continue validation
gc_grace_seconds=0
a If there is no live data, validation passes. Keys are properly obsoleted
b If there is live data, validation fails and throws to abort compaction if it's not dry run.
Configs:
cassandra.compaction_validation_mode=NONE
, available options: NONE/WARN/ABORT