Add local copy of CommitWriteBuffer with rollback in WriteProcessor - #544
Open
cyrusknopf wants to merge 1 commit into
Open
Add local copy of CommitWriteBuffer with rollback in WriteProcessor#544cyrusknopf wants to merge 1 commit into
cyrusknopf wants to merge 1 commit into
Conversation
cyrusknopf
commented
Mar 26, 2026
Comment on lines
+186
to
+192
| try { | ||
| Dispatcher::dispatch(valueColumn, toVec); | ||
| } catch (const std::exception& e) { | ||
| return WriteError {e.what()}; | ||
| } catch (...) { | ||
| return WriteError {"Unknown error."}; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Unfortunately I think this try ... catch might be unavoidable, without adding a result type to the functor passed to the dispatcher
rjb32
reviewed
Mar 27, 2026
| throw FatalException(fmt::format("Attempted to create edge {} with " | ||
| "target node with no such column: {}", | ||
| edge._name, edge._tgtTag.getValue())); | ||
| return WriteError {fmt::format("Attempted to create edge {} with " |
Contributor
There was a problem hiding this comment.
Please use the construction style with parenthesis
| } | ||
| } else { // Column(Opt)Vector -> unique property for each node | ||
| getUntypedProperties(valueColumn, propsBuffer, pid); | ||
| WriteResult res = getUntypedProperties(valueColumn, propsBuffer, pid); |
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.
This is more a proof of concept of a fix that needs to be added.
It may be possible that
WriteProcessor::executemodifies theCommitWriteBufferof the current change, and errors in the same cycle. This violates the atomicity of a single query. This PR adds a naïve fix of keeping a copy of theCommitWriteBufferonprepare, and rolling back to the local copy before throwing any exceptions to be caught by theQueryInterpreter.Implemented in this PR by using
Resulttypes in theWriteProcessorinstead of exceptions. This means we have minimaltry ... catchblocks, and that errors can be propagated up to a single point, where the rollback occurs if it needs to, and then finally an exception can be thrown to be caught byQueryInterpreter.