Repository navigation
fix(pd): name an unavailable PD leg with the same 503 code as the other routers #2479
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,8 +209,12 @@ impl PDRouter { | |
| PdSelectionFailure::Shed(shed) => shed, | ||
| PdSelectionFailure::Unavailable(error) => { | ||
| error!("Failed to select PD pair error={}", error); | ||
| // Same code the regular HTTP router and the gRPC routers use | ||
| // for a leg that is merely down, so a client can key its | ||
| // retry on one code whatever the transport; the message | ||
| // still names the leg. | ||
| error::service_unavailable( | ||
| "server_selection_failed", | ||
| "no_available_workers", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Important: This path carries more than "a leg that is merely down", so unifying on
The two paths this PR is aligning with both split
Splitting the verdict keeps the unification and closes the collision: fn pair_failure(failure: PairFailure) -> PdSelectionFailure {
// ...
match failure.verdict {
PlacementFailure::AllOverloaded(shed) => PdSelectionFailure::Shed(shed),
PlacementFailure::NoCandidates => PdSelectionFailure::NotFound(/* leg */),
// ...
}
}with |
||
| format!("No available servers: {error}"), | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Nit: No test pins the new code, so nothing in-repo stops it drifting back.
no_available_workersnow appears inpd_router.rsonly at line 217 — production code, no assertion. The two paths this PR aligns with each lock their code in with a header assertion (router.rs:2358,worker_selection.rs:1266and:1313), andtest_empty_worker_listsat line 2357 only matches on thePdSelectionFailurevariant and its message string, never on the rendered response.Since the point of the change is a client-visible contract rather than an internal refactor, a test that drives
handle_server_selection_errorand assertsHEADER_X_SMG_ERROR_CODE == "no_available_workers"(plus the 503) would be worth adding — it's also what would have caught theNoCandidatesoverlap flagged below.