-
Notifications
You must be signed in to change notification settings - Fork 7
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
LevelDB with 2 databases #126
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
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.
Leaving some initial thoughts, though I haven't taken a deep look into the entire PR.
This reverts commit fff2ad6.
Co-authored-by: Goran Rojovic <[email protected]>
@@ -0,0 +1,101 @@ | |||
//nolint:stylecheck |
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.
Can we revert this?
//nolint:stylecheck |
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 we do then this error appears
ST1003: should not use ALL_CAPS in Go names; use CamelCase instead (stylecheck)
HEAD_HASH = uint8(2) | LOOKUP_INDEX
I think we should keep it, those are constants. It's better that way and it's already used in couple of files.
} | ||
|
||
func getKey(n uint64, h types.Hash) []byte { | ||
return append(append(make([]byte, 0, 40), common.EncodeUint64ToBytes(n)...), h.Bytes()...) |
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.
Nitpick: maybe code bellow will optimize memory allocation a little bit
a, b := common.EncodeUint64ToBytes(n), h.Bytes()
return append(append(make([]byte, 0, len(a) + len(b)), a...), b...)
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 thanks, will change this through some other PR.
} | ||
|
||
var tableMapper = map[uint8][]byte{ | ||
// Main DB |
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 do we use suffixes instead of prefixes?
Why lookup DB do not have suffixes at all?
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 do we use suffixes instead of prefixes?
With suffixes write into main DB is sequential, with prefixes is random.
Why lookup DB do not have suffixes at all?
Because there is no need for suffixes, data is already unique.
Description
Addes storageV2 with leveldb having 2 databases with perf tests.
Changes include
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Checklist
Testing
Manual tests
Please complete this section if you ran manual tests for this functionality, otherwise delete it
Documentation update
Please link the documentation update PR in this section if it's present, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it