Skip to content

Conversation

DaveCTurner
Copy link
Contributor

Recent improvements to the primitives for writing async code (particularly #92452 and #92620) mean that we can enormously simplify TransportNodesAction. In particular, we can avoid accumulating an intermediate array of responses for later processing in favour of just accumulating the successes and failures into their final separate lists. We also no longer need to use a separate NodesResponseTracker to discard responses on cancellation.

Recent improvements to the primitives for writing async code
(particularly elastic#92452 and elastic#92620) mean that we can enormously simplify
`TransportNodesAction`. In particular, we can avoid accumulating an
intermediate array of responses for later processing in favour of just
accumulating the successes and failures into their final separate lists.
We also no longer need to use a separate `NodesResponseTracker` to
discard responses on cancellation.
@DaveCTurner DaveCTurner added :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. >refactoring v8.7.0 labels Jan 17, 2023
@DaveCTurner DaveCTurner requested a review from gmarouli January 17, 2023 14:17
@elasticsearchmachine elasticsearchmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Jan 17, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@DaveCTurner
Copy link
Contributor Author

@gmarouli I thought you'd be interested in this because of your work in this area, particularly #82685.

@gmarouli
Copy link
Contributor

@DaveCTurner thanks! Indeed, I am :). I am catching up on the changes and I will review it right away!

Copy link
Contributor

@gmarouli gmarouli left a comment

Choose a reason for hiding this comment

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

Nice work, I have some minor comments and a few questions that will help me learn too. Thank you for improving this.

Copy link
Contributor

@gmarouli gmarouli left a comment

Choose a reason for hiding this comment

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

I didn't get a ping to review again but all my comments were addressed so LGTM 🚀
Thanks @DaveCTurner

@DaveCTurner DaveCTurner merged commit 976b651 into elastic:main Jan 19, 2023
@DaveCTurner DaveCTurner deleted the 2023-01-17-simplify-TransportNodesAction branch January 19, 2023 15:06
@DaveCTurner
Copy link
Contributor Author

Thanks @gmarouli !

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Feb 2, 2023
Similarly to elastic#92987, recent improvements to the primitives for writing
async code (particularly elastic#92452 and elastic#92620) mean that we can enormously
simplify `TransportBroadcastByNodeAction`. In particular, we can avoid
accumulating an intermediate array of responses for later processing in
favour of just accumulating the successes and failures into their final
separate lists. We also no longer need to use a separate
`NodesResponseTracker` to discard responses on cancellation. Finally, we
can now discard shard-level responses more promptly on cancellation.
elasticsearchmachine pushed a commit that referenced this pull request Feb 7, 2023
Similarly to #92987, recent improvements to the primitives for writing
async code (particularly #92452 and #92620) mean that we can enormously
simplify `TransportBroadcastByNodeAction`. In particular, we can avoid
accumulating an intermediate array of responses for later processing in
favour of just accumulating the successes and failures into their final
separate lists. We also no longer need to use a separate
`NodesResponseTracker` to discard responses on cancellation. Finally, we
can now discard shard-level responses more promptly on cancellation.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request May 23, 2023
Each `TransportTasksAction` fans-out to multiple nodes, accumulates
responses and retains them until all the nodes have responded, and then
converts the responses into a final result.

Similarly to elastic#92987 and elastic#93484, we should accumulate the responses in a
structure that doesn't require so much copying later on, and should drop
the received responses if the task is cancelled while some nodes'
responses are still pending.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request May 26, 2023
We have this somewhat-complex pattern in 3 places already, and elastic#96279
will introduce a couple more, so this commit extracts it as a dedicated
utility.

Relates elastic#92987
Relates elastic#93484
DaveCTurner added a commit that referenced this pull request May 26, 2023
We have this somewhat-complex pattern in 3 places already, and #96279
will introduce a couple more, so this commit extracts it as a dedicated
utility.

Relates #92987
Relates #93484
elasticsearchmachine pushed a commit that referenced this pull request May 30, 2023
Each `TransportTasksAction` fans-out to multiple nodes, accumulates
responses and retains them until all the nodes have responded, and then
converts the responses into a final result.

Similarly to #92987 and #93484, we should accumulate the responses in a
structure that doesn't require so much copying later on, and should drop
the received responses if the task is cancelled while some nodes'
responses are still pending.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. >refactoring Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants