-
Notifications
You must be signed in to change notification settings - Fork 862
Upgrade to PebbleDB v2 + Add DefaultComparer Config Option #2695
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2695 +/- ##
==========================================
- Coverage 43.76% 43.74% -0.02%
==========================================
Files 1914 1914
Lines 159504 159536 +32
==========================================
- Hits 69801 69785 -16
- Misses 83284 83329 +45
- Partials 6419 6422 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
|
||
| // Select comparer based on config. Note: UseDefaultComparer is NOT backwards compatible | ||
| // with existing databases created with MVCCComparer - Pebble will refuse to open due to | ||
| // comparer name mismatch. Only use UseDefaultComparer for NEW databases. |
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.
if mismatch happens, is there a way we can show some errors to the user?
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.
or the pebble already has the error inside?
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.
It will fail to open the db @blindchaser , so error will show up
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.
Will paste snippet of the error
|
@yzang2019 @yzang2019 @jewei1997 please take a look again |
| // instead of MVCCComparer. This is useful for new databases that don't need backwards compatibility. | ||
| // Note: Iterator tests are skipped because DefaultComparer doesn't have the Split function | ||
| // configured for MVCC key encoding, so NextPrefix/SeekLT operations won't work correctly. | ||
| func TestStorageTestSuiteDefaultComparer(t *testing.T) { |
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.
@masih likely a cleaner way to do this, but we want to eventually remove all iteration from state store. Right now its an artifact of cosmos (iteration) in v2
| } | ||
|
|
||
| func (s *StorageTestSuite) TestDatabaseIteratorEmptyDomain() { | ||
| if slices.Contains(s.SkipTests, s.T().Name()) { |
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.
@masih again, likely a cleaner way to do this, but we want to eventually remove all iteration from state store. Right now its an artifact of cosmos (iteration) in v2
| } | ||
|
|
||
| func OpenDB(dataDir string, config config.StateStoreConfig) (*Database, error) { | ||
| cache := pebble.NewCache(1024 * 1024 * 32) |
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.
Unrelated to this PR: we probably should bump this value. It seems small for seid?
| "TestStorageTestSuiteDefaultComparer/TestDatabasePrune", | ||
| "TestStorageTestSuiteDefaultComparer/TestDatabasePruneKeepRecent", | ||
| "TestStorageTestSuiteDefaultComparer/TestParallelWriteAndPruning", | ||
| } |
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.
This is unfortunately error-prone, and can silently result in false negative test failures if we rename any of the tests.
My advice would be to avoid this. I see 2 options:
-
fork the test sets that we want to have going forward for the default comparator. Then when the MVCC comparator retires remove entire tests for it.
-
break up the test suits into 2, and have one extend the other where the extended suit runs the current superset of tests for MVCC. This solves your concern about code drift and would avoid the kind of config we see here as well as conditional skip tests. Let me know if you have questions on how to extend the suit while avoiding duplicate code
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.
Yea I think for (1) I was concerned about the forks not matching. (2) seems reasonable, let me think on this though if there is a more efficient approach
Describe your changes and provide context
PebbleDB v2 Upgrade:
DefaultComparer Option:
Testing performed to validate your change