-
Notifications
You must be signed in to change notification settings - Fork 65
starknet_committer: add mdbx storage #8917
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
starknet_committer: add mdbx storage #8917
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
41118e5
to
daf27f9
Compare
62764e3
to
03ea0b4
Compare
Benchmark movements: No major performance changes detected. |
daf27f9
to
696af3c
Compare
03ea0b4
to
90c575e
Compare
696af3c
to
d911717
Compare
d62797f
to
fd3ce7a
Compare
d911717
to
0b52a49
Compare
fd3ce7a
to
91008e4
Compare
0b52a49
to
3ad2b8a
Compare
91008e4
to
68ada84
Compare
3ad2b8a
to
e37df54
Compare
68ada84
to
94c835b
Compare
e37df54
to
1f76508
Compare
94c835b
to
2603923
Compare
1f76508
to
06b73ee
Compare
2603923
to
09b5dc6
Compare
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.
@dorimedini-starkware reviewed 3 of 6 files at r4, 3 of 3 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 21 at r5 (raw file):
// LIFO policy for recycling a Garbage Collection items should be faster when using // disks with write-back cache. liforeclaim: true,
what's this...?
Code quote:
// LIFO policy for recycling a Garbage Collection items should be faster when using
// disks with write-back cache.
liforeclaim: true,
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 43 at r5 (raw file):
let table = txn.open_table(None)?; let prev_val = txn.get(&table, &key.0)?.map(DbValue); txn.put(&table, key.0, value.0, WriteFlags::UPSERT)?;
what's this?
Code quote:
WriteFlags::UPSERT
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 54 at r5 (raw file):
for key in keys { res.push(txn.get(&table, &key.0)?.map(DbValue)); }
libmdbx doesn't have a faster implementation of multi-read?
Code quote:
for key in keys {
res.push(txn.get(&table, &key.0)?.map(DbValue));
}
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 63 at r5 (raw file):
for (key, value) in key_to_value { txn.put(&table, key.0, value.0, WriteFlags::UPSERT)?; }
same Q (no faster impl?)
Code quote:
for (key, value) in key_to_value {
txn.put(&table, key.0, value.0, WriteFlags::UPSERT)?;
}
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 75 at r5 (raw file):
txn.del(&table, &key.0, None)?; } txn.commit()?;
is this required if prev_val
is None
?
Code quote:
txn.commit()?;
114e111
to
fd1fbdd
Compare
09b5dc6
to
b00a2ca
Compare
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.
@dorimedini-starkware reviewed 16 of 16 files at r7, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)
fd1fbdd
to
386ce2a
Compare
b00a2ca
to
795c122
Compare
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.
@TzahiTaub reviewed 1 of 6 files at r4, 1 of 3 files at r5.
Reviewable status: 3 of 20 files reviewed, all discussions resolved (waiting on @dorimedini-starkware and @yoavGrs)
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 21 at r5 (raw file):
Previously, dorimedini-starkware wrote…
what's this...?
Added a TODO to go deeper into this later.
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 43 at r5 (raw file):
Previously, dorimedini-starkware wrote…
what's this?
UPdate if key exists, inSERT otherwise.
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 54 at r5 (raw file):
Previously, dorimedini-starkware wrote…
libmdbx doesn't have a faster implementation of multi-read?
Don't see one.
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 63 at r5 (raw file):
Previously, dorimedini-starkware wrote…
same Q (no faster impl?)
Don't see one.
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.
Reviewable status: 3 of 20 files reviewed, all discussions resolved (waiting on @dorimedini-starkware and @yoavGrs)
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 75 at r5 (raw file):
Previously, dorimedini-starkware wrote…
is this required if
prev_val
isNone
?
Nope
795c122
to
e2adee5
Compare
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.
@dorimedini-starkware reviewed 2 of 17 files at r8, 1 of 1 files at r9, all commit messages.
Reviewable status: 6 of 20 files reviewed, all discussions resolved (waiting on @yoavGrs)
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 22 at r9 (raw file):
// TODO(tzahi): geometry and related definitions are taken from apollo_storage. Check if there are // better configurations for the committer and consider moving boh crates mdbx code to a common // location.
move this TODO to MdbxStorage::open
please
Suggestion:
// TODO(tzahi): geometry, liforeclaim and related definitions are taken from apollo_storage. Check if there are
// better configurations for the committer and consider moving boh crates mdbx code to a common
// location.
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 26 at r9 (raw file):
// Size in bytes. const MDBX_MIN_PAGESIZE: usize = 256; const MDBX_MAX_PAGESIZE: usize = 65536; // 64KB
non-blocking, but if it works - it looks nicer
Suggestion:
const MDBX_MIN_PAGESIZE: usize = 1 << 8;
const MDBX_MAX_PAGESIZE: usize = 1 << 16; // 64KB
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 34 at r9 (raw file):
if !page_size.is_power_of_two() { page_size = page_size.next_power_of_two() / 2; }
any reason to clamp
again after this?
is it possible that MDBX_MIN_PAGESIZE
will not be a power of two?
Code quote:
// Page size must be power of two.
if !page_size.is_power_of_two() {
page_size = page_size.next_power_of_two() / 2;
}
e2adee5
to
3a6490f
Compare
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.
Reviewable status: 3 of 20 files reviewed, all discussions resolved (waiting on @dorimedini-starkware and @yoavGrs)
crates/starknet_patricia_storage/src/mdbx_storage.rs
line 34 at r9 (raw file):
Previously, dorimedini-starkware wrote…
any reason to
clamp
again after this?
is it possible thatMDBX_MIN_PAGESIZE
will not be a power of two?
This is a copy of the code in apollo_storage
. I don't think it can be something else, but I wouldn't want to diverge from or change the code in apollo_storage in this PR.
And see (old answers here): https://stackoverflow.com/questions/40518454/is-it-safe-to-assume-memory-page-size-is-a-power-of-two
Seems that it would always be a power of 2 unless someone is making an exercise in a CS course.
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.
@dorimedini-starkware reviewed 3 of 3 files at r10, all commit messages.
Reviewable status: 6 of 20 files reviewed, all discussions resolved (waiting on @yoavGrs)
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.
@dorimedini-starkware reviewed 14 of 17 files at r8.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)
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.
@TzahiTaub reviewed 1 of 6 files at r4, 3 of 3 files at r10, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)
No description provided.