-
Notifications
You must be signed in to change notification settings - Fork 589
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
[v23.2.x]] kafka: Abort fetch and list_offsets when client disconnects #12981
Merged
BenPope
merged 13 commits into
redpanda-data:v23.2.x
from
BenPope:backport-pr-12021-v23.2.x
Aug 24, 2023
Merged
[v23.2.x]] kafka: Abort fetch and list_offsets when client disconnects #12981
BenPope
merged 13 commits into
redpanda-data:v23.2.x
from
BenPope:backport-pr-12021-v23.2.x
Aug 24, 2023
Conversation
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
`wait_for_input_shutdown` allows detection of disconnection of the peer via TCP keepalive. Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit 6f20ed2)
Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit f88fd9b)
The `sharded_abort_source` is subscribed to the `net::server::abort_source`, so that it is aborted when the server is aborted, but can also be manually aborted earlier. Some requests such as fetch require results from several partitions, which live on disparate cores; a sharded abort source enables that. Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit 090951f) Conflicts: src/v/kafka/server/connection_context.cc (due to coroutineization on dev)
Abort the `abort_source `when a peer disconnects. Use an exception type that satisfies `net::is_disconnect_exception` Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit ecb5c2f)
Expose the `connection_context::abort_source` through an interface in case a new lifetime needs to exist on the request at a future time. Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit 3b5da87)
Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit c79a582)
Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit 28bd70b)
Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit 7318818) Conflicts: src/v/kafka/server/handlers/fetch.h (includes)
Signed-off-by: Ben Pope <[email protected]> (cherry picked from commit 7e18eeb)
(cherry picked from commit 40b6fc3)
`remote_partition` can in theory receive an abort at any time. The most common case would be a client disconnect. Previously, this was handled by returning the reader to the `materialized_segment_state`. This is dangerous since the abort may catch us at a bad time and return a reader in an undefined state. We've seen this cause issues when the reader gets reused. (cherry picked from commit 99920be)
An instance of partition_record_batch_reader_impl can be aborted by two abort sources: 1. The abort source threaded in from the Kafka layer via `log_reader_config` 2. The abort source of `remote_partition` itself. In both cases, the reader should exit. This patch achieves this by monitoring both abort sources in the read loop and inserting strategical checks between scheduling points. This approach is not ideal, but `partition_record_batch_reader_impl` and `remote_segment_batch_reader` are very closely coupled which makes it difficult to approach things differently. (cherry picked from commit bb46b94)
This allows us to differentiate the reason for an abort and also avoid "expected" error logs. Fixes redpanda-data#12722 Fixes redpanda-data#12723 Co-Authored-By: Ben Pope <[email protected]> (cherry picked from commit 7cdb6c0) Conflicts: src/v/net/connection.cc (includes)
VladLazar
approved these changes
Aug 24, 2023
StephanDollberg
approved these changes
Aug 24, 2023
/cdt |
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.
Backport of PR #12021
Backport of PR #12955
Fixes: #12649