-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kvstreamer: ask for a separate LeafTxn
This commit fixes the streamer so that it uses a LeafTxn that is not shared with any other components. Such a setup is needed in order to avoid spurious "context canceled" errors returned when multiple streamers are part of the same flow. Consider the following setup. We have a remote flow consisting of two trees of operators rooted in the outboxes: ``` └ Node 2 ├ *colrpc.Outbox │ └ *rowexec.joinReader ... └ *colrpc.Outbox └ *rowexec.joinReader ``` Both of the join readers use the streamer API and run in separate goroutines (because outboxes run in separate goroutines). Then let's imagine that one of the outboxes is moved to draining while the corresponding streamer is still evaluating requests. The join reader will call `Streamer.Close` which cancels the context of the requests' evaluation. This cancellation "poisons" the txn used by that streamer with `ERROR: txn already encountered an error`. Now let's imagine that the second tree of operators is not done yet and needs to produce more data. Whenever the streamer in that tree tries to evaluate some requests, it would run into the "poisoned" txn error. This commit goes around this problem by giving a separate LeafTxn to each streamer so that a streamer from one tree could not poison the txn of the streamer from another tree. The non-streamer code path doesn't run into a similar problem because it doesn't eagerly cancel the outstanding requests. I think a similar change (to give the streamer a separate leaf txn) will also be needed to support the transparent refresh mechanism in some cases, so this commit is beneficial from that point of view too. I spent some time attempting to write a regression test, but it is quite difficult to come up with something reliable here, and I decided to not spend more time on it. Release note: None
- Loading branch information
1 parent
d9fd5bf
commit 6c88496
Showing
5 changed files
with
44 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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