-
Notifications
You must be signed in to change notification settings - Fork 493
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: kv impl #5212
feat: kv impl #5212
Conversation
e75cbb9
to
b9c5483
Compare
Codecov Report
@@ Coverage Diff @@
## master #5212 +/- ##
==========================================
- Coverage 55.44% 54.60% -0.85%
==========================================
Files 447 461 +14
Lines 63272 64284 +1012
==========================================
+ Hits 35083 35103 +20
- Misses 25810 26783 +973
- Partials 2379 2398 +19
... and 10 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Since you can do reads against pending pebble Batches (and even indexed iterators/scans if you use NewIndexedBatch) to see a merged view of the batch and underlying DB — WDYT of exposing this ability to the interface, so that it is possible in certain cases to read against pending writes, like SQL does? |
2e3cb9b
to
22a8c70
Compare
be15df3
to
52c7ca7
Compare
7514693
to
f690185
Compare
2876836
to
f23c5bc
Compare
Merged as sub-PRs |
Summary
Initial KV implementation.
StorageEngine
has been added to pick which engine to use.Key Schema
The key schema as written presently uses human readable prefixes, for ease and debugging and development as this storage engine is built. We intend on compressing these values down to a minimal prefix to save on storage later on.
Additionally, there are some optimizations which are already identified which will affect parts of this key schema once implemented. Those optimizations were not pursued as part of this PR as we are looking to reproduce our SQL engine as closely as possible.
This schema is designed to use
get
to retrieve specific values, anditerators
to produce a range of results which can be filtered or returned. Iterators can range over a partial (prefix-matching) key in order to return all keys which fit the prefix. For example, a partial key ofonline_account_base-ABCDEFG
would return the online account base information for the account ABCDEFG for every persisted round. Fully qualifying the key asonline_account_base-ABCDEFG-123
would return just the data from round 123.Accounts
Index 1: "account-
<address>
"Index 2: "account_balance-
<balance_amount>
-<account>
"Online Accounts
Index 1: "online_account_base-
<address>
-<round>
Index 2: "online_account_balance-
<round>
-<balance>
-<account>
"Resources
"resource-
<address>
-<index>
"Creator
"creator-
<index>
"Application KV
"appkv-
<key>
"UpsertKvPair
Globals and other singleton-ish keys
"global_round"
"global_totals-
<stage>
""online_balance_total-
<round>
""txtail-
<round>
""online_account_round_params-
<round>
"Important Notes
WARNING: The
pebbledb
engine remains UNDER DEVELOPMENT and is not intended to be used in production.We are currently still working on making sure the implementations are compatible.
The work was done in collab with @AlgoAxel
Test Plan
We added some initial tests on the storage test suite.
We will slowly move some of the existing tests that focus on "storage" to this test suite.
We have not made a decision on which storage engine the remaining high level test should be using. For now they will remain using sqlite /sqlite (in memory).