fix(set): propagate storage errors in Set instead of treating as NotFound#3428
Merged
Merged
Conversation
jihuayu
reviewed
Apr 8, 2026
jihuayu
left a comment
Member
There was a problem hiding this comment.
Great!
It seems SREM has the same issue. Could you fix it as well and add the corresponding test cases?
61465b4 to
d52e83d
Compare
Contributor
Author
|
PragmaTwice
approved these changes
Apr 8, 2026
jihuayu
approved these changes
Apr 8, 2026
|
nagisa-kunhah
pushed a commit
to nagisa-kunhah/kvrocks
that referenced
this pull request
Apr 29, 2026
…ound (apache#3428) Previously, when `storage_->Get()` returned a non-NotFound error (e.g., I/O error or corruption) during SADD, the code fell through to the `batch->Put` path, incorrectly treating the error as "member not found" and adding the member. This could silently inflate `metadata.size` and insert duplicate members on storage failures. Add an explicit `!s.IsNotFound()` check to propagate real errors, which is consistent with how `Set::Remove` already handles the same pattern. --------- Co-authored-by: 纪华裕 <jihuayu123@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Previously, when
storage_->Get()returned a non-NotFound error (e.g., I/O error or corruption) during SADD, the code fell through to thebatch->Putpath, incorrectly treating the error as "member not found" and adding the member. This could silently inflatemetadata.sizeand insert duplicate members on storage failures.Add an explicit
!s.IsNotFound()check to propagate real errors, which is consistent with howSet::Removealready handles the same pattern.