-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix Snapshot to handle deleteSet properly when a delete operation is mixed with other operations. #138
Conversation
…mixed with other operations
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!
} | ||
|
||
public Optional<TransactionResult> get(Snapshot.Key key) { | ||
if (writeSet.containsKey(key)) { | ||
throw new CrudRuntimeException("reading already written data is not allowed"); | ||
} else if (deleteSet.containsKey(key)) { | ||
return Optional.empty(); |
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 we allow reading already deleted data while we don't allow reading already written data?
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.
Thank you for the question!
This is because we can return empty
for the already deleted records.
The reason why we throw an exception for reading already written data is we can't create Result
from Put
since Put
might not have a full set of values.
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.
Ah okay. I understood. Thank you for the clear explanation! I'll approve this.
} | ||
|
||
public Optional<TransactionResult> get(Snapshot.Key key) { | ||
if (writeSet.containsKey(key)) { | ||
throw new CrudRuntimeException("reading already written data is not allowed"); | ||
} else if (deleteSet.containsKey(key)) { | ||
return Optional.empty(); |
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.
Ah okay. I understood. Thank you for the clear explanation! I'll approve this.
@Yonezawa-T2 I'm mering it but PTAL when you get a chance since I might miss something. |
https://scalar-labs.atlassian.net/browse/DLT-7979