Skip to content
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

Merged
merged 67 commits into from
Aug 21, 2023

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Aug 3, 2023

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...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

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...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@faddat
Copy link
Contributor

faddat commented Aug 4, 2023

What's ss?

@samricotta
Copy link
Contributor

@faddat State Storage

@alexanderbez
Copy link
Contributor Author

What's ss?

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.

Base automatically changed from bez/store-v2-api-prototype to feature/store-v2 August 9, 2023 18:28
@alexanderbez alexanderbez marked this pull request as ready for review August 15, 2023 17:10
// <key>\x00[<version>]<#version-bytes>
func MVCCEncode(key []byte, version uint64) (dst []byte) {
dst = append(dst, key...)
dst = append(dst, 0)
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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)

Copy link
Contributor Author

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.

store/storage/pebbledb/db.go Show resolved Hide resolved

batch := db.storage.NewBatch()

if err := batch.Set([]byte(latestVersionKey), versionBz[:], nil); err != nil {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct!

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@alexanderbez alexanderbez merged commit a1a289f into feature/store-v2 Aug 21, 2023
46 of 48 checks passed
@alexanderbez alexanderbez deleted the bez/17225-pebbledb-ss-backend branch August 21, 2023 17:24
@alexanderbez alexanderbez mentioned this pull request Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants