Skip to content
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

Store error on transaction stream #368

Merged

Conversation

flyingsilverfin
Copy link
Member

@flyingsilverfin flyingsilverfin commented Jan 21, 2022

What is the goal of this PR?

We store any exceptions received against the transaction stream (as well as query streams) in order to propagate the error to any future transaction operations, not just open query streams.

What are the changes implemented in this PR?

  • store errors against query streams and transaction streams, so we can error on transaction operations against a closed transaction

@flyingsilverfin flyingsilverfin changed the title Store error against bidirectional stream Store error on transaction stream Jan 21, 2022
@flyingsilverfin flyingsilverfin marked this pull request as ready for review January 21, 2022 16:09
else {
state = State.EMPTY;
return next;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we make the next() idempotently throw the same error if the user repeatedly calls it

@@ -108,6 +111,7 @@ public void close() {

private void close(@Nullable StatusRuntimeException error) {
if (isOpen.compareAndSet(true, false)) {
this.error = error;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store the closure error against the bidirectional stream to prevent future transaction operations

@flyingsilverfin flyingsilverfin merged commit 63df336 into typedb:master Jan 21, 2022
@flyingsilverfin flyingsilverfin deleted the transaction-stream-exception branch January 21, 2022 16:43
lolski pushed a commit that referenced this pull request Mar 14, 2022
## What is the goal of this PR?

We revert previous changes from #368 and #364, which made query queues and iterators throw the same error idempotently if there was one. However, this goes counter to standard usages of iterators and queues, which are not meant to behave idempotently (each item is only returned once, and if they have an error they should no longer be used). 

## What are the changes implemented in this PR?

* remove idempotent error state of collectors and queues, which back query iterators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants