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

tx_migration: avoid ping pong of requests between brokers #15953

Merged
merged 2 commits into from
Jan 6, 2024

Conversation

bharathv
Copy link
Contributor

@bharathv bharathv commented Jan 4, 2024

When leader table is stale (say at startup or during failures), the
current code can result in a ping pong of requests between two brokers
in a tight loop.

Example

  • tx_migration_replicate dispatched from node 1 to node 2 (because node 1
    thinks node 2 is the leader)
  • node 2 dispatches the request back to node 1 because it thinks node 1
    is the leader.

Until leadership stabilizes this results in a huge pile up of requests
which manifested as an oversized allocation.

Don't think a router is the right choice in the handler as the handler
is supposed to process the request locally. If it returns an error, it
is propagated to the source router which dispatches to the correct
leader. This also breaks the ping pong loop as the source router has
sleeps induced for retry backoff.

Fixes: #15901

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x
  • v23.1.x

Release Notes

  • none

When leader table is stale (say at startup or during failures), the
current code can result in a ping pong of requests between two brokers
in a tight loop.

Example

- tx_migration_replicate dispatched from node 1 to node 2 (because node 1
thinks node 2 is the leader)
- node 2 dispatches the request back to node 1 because it thinks node 1
is the leader.

Until leadership stabilizes this results in a huge pile up of requests
which manifested as an oversized allocation.

Don't think a router is the right choice in the handler as the handler
is supposed to process the request locally. If it returns an error, it
is propagated to the source router which dispatches to the correct
leader. This also breaks the ping pong loop as the source router has
sleeps induced for retry backoff.
@vbotbuildovich
Copy link
Collaborator

new failures in https://buildkite.com/redpanda/redpanda/builds/43450#018cd6dd-f8b9-42e9-8821-73b33cbb5da4:

"rptest.tests.internal_topic_protection_test.InternalTopicProtectionLargeClusterTest.test_schemas_topic"

@bharathv
Copy link
Contributor Author

bharathv commented Jan 5, 2024

/ci-repeat 1
dt-repeat=20
skip-units
skip-redpanda-build
tests/rptest/tests/tx_coordinator_migration_test.py::TxCoordinatorMigrationTest.test_migrating_tx_manager_coordinator

@bharathv
Copy link
Contributor Author

bharathv commented Jan 5, 2024

Failure is a known issue #15944

@piyushredpanda piyushredpanda merged commit 8174bc1 into redpanda-data:dev Jan 6, 2024
18 of 20 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

@bharathv bharathv deleted the tx_migration_fix_alloc branch January 8, 2024 16:13
nvartolomei added a commit to nvartolomei/redpanda that referenced this pull request Apr 16, 2024
A tight forward-to-leader loop has been discovered in a test where
metadata about leader is out of date:
redpanda-data#17873.

Instead, we remove the forwarding from the request handler and do it
only once on the original invoker. In
`id_allocator_frontend::allocate_id` we call
`allocate_router::process_or_dispatch` which will do the redirect and
retry if the target node returns an error/does not respond. It also has
backoff built in.

This is a fix very similar to one described in
redpanda-data#15953.

Fixes redpanda-data#17873
vbotbuildovich pushed a commit to vbotbuildovich/redpanda that referenced this pull request Apr 16, 2024
A tight forward-to-leader loop has been discovered in a test where
metadata about leader is out of date:
redpanda-data#17873.

Instead, we remove the forwarding from the request handler and do it
only once on the original invoker. In
`id_allocator_frontend::allocate_id` we call
`allocate_router::process_or_dispatch` which will do the redirect and
retry if the target node returns an error/does not respond. It also has
backoff built in.

This is a fix very similar to one described in
redpanda-data#15953.

Fixes redpanda-data#17873

(cherry picked from commit f388566)
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.

Oversized allocation: 282624 bytes in rpc::transport::make_response_handler
4 participants