-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: PebbleDB SS Backend Implementation #17280
feat: PebbleDB SS Backend Implementation #17280
Conversation
What's ss? |
@faddat State Storage |
Yes, it means State Storage, where direct (versioned) key/value pairs will be written to. This is where queries will go against making that layer more performant. |
// <key>\x00[<version>]<#version-bytes> | ||
func MVCCEncode(key []byte, version uint64) (dst []byte) { | ||
dst = append(dst, key...) | ||
dst = append(dst, 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.
what is the use-case of \x00
separator?
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's necessary for MVCC support. See: https://github.com/cockroachdb/pebble/blob/master/cmd/pebble/mvcc.go#L76-L88
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 this is only used for the key split, I think \x00
and version-bytes
are unnecessary since the version encoding size is fixed (8)
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.
Personally, I feel very apprehensive in changing any of the MVCC stuff. I spent nearly a week trying to get this to work and in the end just ported the code from Pebble/Cockroach. If there's no need to change something, I'd rather not. Hope that's OK with you.
|
||
batch := db.storage.NewBatch() | ||
|
||
if err := batch.Set([]byte(latestVersionKey), versionBz[:], nil); err != nil { |
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.
I am not sure, every time it is creating a new batch and setting the latest version, is it right?
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 correct!
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.
OK, so generally we will use the Batch
of pebbledb/batch.go
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.
Description
closes: #17225
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
make lint
andmake test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change