fix: Non-default HTTP retry backoff strategies cannot be selected - #6529
fix: Non-default HTTP retry backoff strategies cannot be selected#6529hengyuss wants to merge 10 commits into
Conversation
- Add HttpRetryBackoffSpecEnumTest for acquireByName coverage - Add retryBackOffSpec getter/setter test in DivideRuleHandleTest - Add DividePluginTest assertions for HTTP_RETRY_BACK_OFF_SPEC attribute - Fix plugin_handle sort conflict: retryBackOffSpec sort 0→1 - Disable custom dict entry (enabled 1→0) in all SQL dialects - Remove CUSTOM_BACKOFF enum value and CustomRetryStrategy class - Remove CUSTOM_BACKOFF case from AbstractHttpClientPlugin switch
8d985ef to
432de3b
Compare
Aias00
left a comment
There was a problem hiding this comment.
Reviewed #6529 — fixes #6464. The root-cause analysis is correct and the fix is sound: Constants.HTTP_RETRY_BACK_OFF_SPEC was "default", used as the exchange attribute key, so nothing ever wrote under it and AbstractHttpClientPlugin always fell back to DefaultRetryStrategy, leaving fixed/exponential/custom unreachable. Renaming the key to "httpRetryBackOffSpec", adding DivideRuleHandle.retryBackOffSpec, populating it in DividePlugin, switching the switch to HttpRetryBackoffSpecEnum, and replacing CustomRetryStrategy's return null with an explicit Mono.error all address the reported defects. Backward compatibility is fine: existing rule-handle JSON lacks the new field, Gson leaves it at the field initializer ("default"), so existing configs keep routing to DefaultRetryStrategy. DB IDs are collision-free and consistent across all 6 init dialects and 5 upgrade scripts. The constant-value change only affects an in-memory attribute key (no persisted JSON key changes; only 3 Java consumers).
Non-blocking, but worth addressing before merge:
-
(should_fix) No regression test for the actual bug.
DivideRuleHandleTest.testGetterSettercovers every sibling field exceptretryBackOffSpec;DividePluginTestdoesn't assertConstants.HTTP_RETRY_BACK_OFF_SPECis placed into the exchange fromruleHandle.getRetryBackOffSpec();RetryStrategyTestexercises strategies in isolation but not the selection switch inAbstractHttpClientPlugin.execute. The whole point of the PR — that a configured non-default spec is actually selected — is untested, so #6464 can regress silently. Suggested additions: (a) aDividePluginTestcase asserting the attribute is set from the rule handle (mirroring theHTTP_RETRY/RETRY_STRATEGYputs); (b)HttpRetryBackoffSpecEnumTestcoveringacquireByNamefor each name + null + unknown →DEFAULT_BACKOFF(every other enum in the package has one); (c) extendtestGetterSetterto set/assertretryBackOffSpec. -
(nit) The new
retryBackOffSpecplugin_handlerow usessort=0, identical toretryStrategy, so the two fields' admin-UI order is non-deterministic. Give it a distinct sort (e.g. 1). -
(nit / open question)
CustomRetryStrategynow throwsUnsupportedOperationException("Please implement CustomRetryStrategy via SPI"). Returning an explicit error is a clear improvement overreturn null, but I couldn't find an SPI/registry for this strategy in the diff or undershenyu-plugin-httpclient. If no extension point exists, consider hidingcustomfrom theRETRY_BACKOFF_SPECdict until one does, since selecting it today always yields a 503.
Note: PR is in BEHIND merge state (needs a rebase onto master before merge).
…ies_cannot_be_selected
…ies_cannot_be_selected
|
Solid, well-tested fix — the string→enum switch in One minor inconsistency: the SQL scripts add a |
…ies_cannot_be_selected
…ff_strategies_cannot_be_selected' into fix/Non_default_HTTP_retry_backoff_strategies_cannot_be_selected
Fixes #6464
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.