-
Notifications
You must be signed in to change notification settings - Fork 867
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
Add FlatDbStrategy #5901
Add FlatDbStrategy #5901
Conversation
|
...eum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/storage/flat/FlatDbStrategy.java
Fixed
Show fixed
Hide fixed
13da7d2
to
4eb1ed6
Compare
// Only ourNearest is present | ||
return ourNearest; | ||
} else { | ||
// Either both are not present, or only parentNearest is present |
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.
// Either both are not present, or only parentNearest is present |
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 think it took me longer to parse this comment than the line of 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.
does this end up being Optional.empty if neither are present? What happens then?
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, if neither are present there was nothing at or before the requested key and we return empty. Callers should expect to handle the optional empty return
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.
does this end up being Optional.empty if neither are present? What happens then?
This question made me add another case that checks we correctly return Optional.empty(). Though the rocksdb nearestTo would behave that way, the In-memory comparators are not. I added a test for this and a filter to the in-memory streaming implementation. 👍
final Hash accountHash, | ||
final Hash slotHash) { | ||
transaction.remove( | ||
ACCOUNT_STORAGE_STORAGE, Bytes.concatenate(accountHash, slotHash).toArrayUnsafe()); |
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.
why is it called ACCOUNT_STORAGE_STORAGE ? there's no ACCOUNT_STORAGE, 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.
yeah, not my favorite name, but it is what the segment enum calls it. It is the underlying storage for account storage, but makes for a weird name. I am all for renaming the flat segments to ACCOUNT_INFO_FLAT, ACCOUNT_STORAGE_FLAT, and CODE_STORAGE_FLAT or something else that is more meaningful. I'd rather do that in another PR though since it would touch a lot of places
.../java/org/hyperledger/besu/ethereum/bonsai/storage/flat/ArchiveFlatDbReaderStrategyTest.java
Outdated
Show resolved
Hide resolved
...ices/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/LayeredKeyValueStorage.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/org/hyperledger/besu/services/kvstore/SegmentedInMemoryKeyValueStorage.java
Show resolved
Hide resolved
21a3368
to
dd4e2b4
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.
LGTM
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
…es the same Signed-off-by: garyschulte <garyschulte@gmail.com>
dd4e2b4
to
850c4ca
Compare
* move FlatDbReader to FlatDbStrategy (including writes), add getNearestTo Signed-off-by: garyschulte <garyschulte@gmail.com> Signed-off-by: Justin Florentine <justin+github@florentine.us>
* move FlatDbReader to FlatDbStrategy (including writes), add getNearestTo Signed-off-by: garyschulte <garyschulte@gmail.com>
PR description
This is a prerequisite PR for #5865 and #5887.
It:
This PR will allow for parallel progress on SnapServer server and Bonsai Archive, and mitigate merge conflicts that would otherwise arise
Fixed Issue(s)
related to #3165 and #5864