Skip to content

[rust] Recover Admin requests after server address changes - #5401

Open
naivedogger wants to merge 3 commits into
apache:mainfrom
naivedogger:codex/rust-admin-request-retry
Open

naivedogger wants to merge 3 commits into
apache:mainfrom
naivedogger:codex/rust-admin-request-retry

Conversation

@naivedogger

Copy link
Copy Markdown
Contributor

Closes #5393

@naivedogger

Copy link
Copy Markdown
Contributor Author

@fresh-borzoni @loserwang1024 could you review this follow-up to #5390? It handles endpoint discovery after a failed Admin request and limits when the client can replay it.

@loserwang1024 loserwang1024 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Compared this with the Java implementation and found two recovery edge cases, detailed inline.

})
.await;
match refreshed {
Ok(tablet) if replay => send(self.select(tablet.as_ref())?).await,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we preserve the single retry for requests that are safe to replay even when this refresh fails? Another concurrent metadata update may already have installed a healthy endpoint while this refresh was querying an old one. This branch still returns the original error without trying the updated endpoint.

Java explicitly preserves this behavior in testMetadataRefreshFailureDoesNotPreventRetry. I reproduced the concurrent-update case here as well. For replayable requests, we could select from the current metadata after a refresh failure and retry once if an eligible node exists, while retaining the existing restriction on ambiguous writes.

// Multi-address startup tries one round. Recovery repeats whole rounds so a
// responsive bootstrap with a stale node list doesn't delay the next address.
if target.is_some() {
Self::retry_bootstrap(bootstrap, round, || {}).await

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we evict the failed bootstrap connection before retrying recovery? The disconnect callback is empty here, and the retry loop does not evict it either. If a bootstrap address sits behind a load balancer, the cached connection can remain attached to an old backend returning no eligible servers, even though a new connection would reach a healthy backend.

Java's MetadataUpdater.tryToInitializeClusterWithRetries() disconnects the failed endpoint before retrying. I reproduced this with a regression test: all four attempts reuse the stale connection; evicting it allows recovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust] Add a reusable retry layer for Admin requests

2 participants