-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add ChecksumAlgorithm option to decides which algorithm calculate checksums. #2197
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
base: main
Are you sure you want to change the base?
feat: add ChecksumAlgorithm option to decides which algorithm calculate checksums. #2197
Conversation
@LiuQhahah Thank you for the PR. Could you help us understand the rationale behind the PR? I will review the PR as soon as I can. Thanks |
Hi @mangalaman93 Thanks |
…o' into qiang/support-multi-checksum-algo
Head branch was pushed to by a user without write access
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.
@LiuQhahah There is one issue I see here. That is, if I update the checksum algorithm on an existing badger directory, it is going to fail in that case. Can we handle that case so that for existing data we use the right checksum algorithm whereas for all the new data we use the new checksum algorithm?
@@ -515,6 +529,19 @@ func pluralFiles(count int) string { | |||
return "files" | |||
} | |||
|
|||
// When the checkSum Algorithm is invalid, func strToChecksumAlgorithm will return the default checkSum Algorithm |
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.
What is benefit of returning the default checksum when we are returning the error along with it? I think we should return default checksum with nil error
Following the current design, I'm unsure about how to proceed. Currently, the options only provide a single value for checksumAlgorithm. If we want to support multiple checksum algorithms, it might mislead users since they wouldn’t know which algorithm was actually used. I suggest sticking with the current design: one Badger directory should use only one checksum algorithm. If users need multi-checksum support, we can discuss it separately. What do you think? Thanks |
Seems like we already store checksum algorithm in the block. We should use that when reading, whereas when writing, we should use the checksum algorithm provided in the option. We should also add a test for this scenario where we open badger with a algo1 for checksum, write and read some data, close badger. Open again with algo2 for checksum, read the old data, write some more new data and read new data. This ensures that we are using the right checksum algorithm. |
Thank you for your information. I will follow this task. |
Description
add ChecksumAlgorithm option to decides which algorithm calculate checksums.
Checklist
Instructions
syntax, leading with
fix:
,feat:
,chore:
,ci:
, etc.link to the bug.
[x]
syntax.back and check the box later.
Instructions
line and everything below it, to indicate you have read and arefollowing these instructions. 🙂
Thank you for your contribution to Badger!