release-22.1: distsql: create LeafTxn eagerly for local flow of a distributed plan #82841
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.
Backport 1/1 commits from #82829 on behalf of @yuzefovich.
/cc @cockroachdb/release
This commit makes it so that we eagerly create LeafTxns for local flows
of distributed plans. I believe it was an oversight in d6077d5
(added during 21.2 release cycle) where we started creating LeafTxns
eagerly when the local flow has concurrency. We can do the same thing
for local flows of distributed queries since we know that they must use
LeafTxns anyway.
This oversight was recently exposed by 6c88496
where some processors began storing the txn internally, rather than
accessing it from the flow context. The thing is that we do update the
references to the correct txn from the flow context, but it is done
after the flow setup has been complete, at which point some processors
might have already captured the wrong txn. In particular, this is the
case for a local flow of a distributed query with index / lookup joins
when the streamer API is disabled.
Fixes: #82775.
Fixes: #82776.
Fixes: #82777.
Fixes: #82783.
Release note: None
Release justification: bug fix.