You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/09/20 18:12:26 UTC

[PR] fix(cluster): keep failed registry loads from silently emptying the tables [rocketmq-dashboard]

unbridled-41 opened a new pull request, #4618:
URL: https://github.com/apache/rocketmq-dashboard/pull/4618

   Fixes #4612.
   
   ## Problem / Evidence
   
   On the cluster page a failed registry load silently wipes the data it was supposed to refresh:
   
   - `loadRegistryClusters` (`web/src/pages/cluster/index.tsx:205-224`, base d50ffecc) catches a failed `listRegistryClusters()` with `setRegistryClusters([])` — no error flag, no message, no retry. The Broker and Proxy tab tables render from `registryClusters`, so one transient 5xx empties both inventories.
   - `loadNsRegistry` (`:230-238`) does the same to the NameServer 注册表 table.
   - These loaders run once on mount (`:226-242`); the 2s auto-refresh loop that drives the green 实时刷新 indicator does not re-run them. After a failure the page therefore shows empty tables next to a pulsing green "live" dot — "no clusters" and "connection healthy" at the same time — until the user manually hits refresh.
   - The same page already has the correct pattern one state over: the instance list failure sets `instanceLoadError` and renders an error panel with a retry button. The registry loaders simply were never aligned with it.
   
   Reproduction is deterministic: open 集群管理 while `/registry/clusters` or `/nameservers/registry` returns a transient failure.
   
   ## Root cause / Fix
   
   The registry loaders treated "request failed" and "request returned empty" identically. Fix: add a `registryLoadError` flag, set it in both catch branches, keep previously loaded rows instead of overwriting them with `[]`, render an error banner (`获取数据失败` + 重试) that re-runs both loaders, and clear the flag on the next successful load.
   
   ## Priority & scoring
   
   PRIORITY 64 = 影响 24 (all three cluster-page data tabs present an empty authoritative-looking inventory after any transient failure) + 波及 10 (two loaders + K8s options, one page) + 可复现 16 (deterministic given a failed request) + 维护价值 14 (reuses the page's established error-state pattern). FIX_CONFIDENCE 92: additive state + one banner, fully covered by a deterministic jsdom regression.
   
   ## Tests
   
   ```
   cd web && npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx
   ```
   - Red (fix stashed, test present): `Unable to find role="alert"` — on master the failed reload renders no error surface and empties the tables.
   - Green: ClusterPage **27 passed (27)** incl. the new regression (banner appears with retry, previously loaded rows survive the failure, retry recovers and clears the banner) and both request-guard tests from the earlier registry work, unchanged.
   - `npx tsc -b`: clean. `npx eslint` on both touched files: 0 errors, 0 warnings. `npm run build`: ✓ built in 8.55s.
   
   ## Risk
   
   Low. Additive to one page: keep-previous-data on failure, a visible failure flag, and a retry action that calls the existing guarded loaders. No API or i18n additions (reuses `common.fetchDataFailed`/`common.retry`). The empty-state semantics of a genuinely empty registry are unchanged — a successful load returning `[]` still clears the tables.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): keep failed registry loads from silently emptying the tables [rocketmq-dashboard]

Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #4618:
URL: https://github.com/apache/rocketmq-dashboard/pull/4618#issuecomment-5760689258

   @lizhimins Thanks for the review — the shared-flag concern was real. Fixed in bc83c516 (branch rebased onto the current trunk `29a7d4ab`).
   
   **Root cause**: the two registry loaders run concurrently (independent on mount, fired together by the refresh button) but wrote one shared `registryLoadError` boolean, so a success on either loader cleared the failure the other had just recorded — e.g. nameserver success after a cluster failure hid the banner while the Broker/Proxy tables kept stale/empty data.
   
   **Review addressed**:
   - Split the flag into per-loader error state: `registryClusterLoadError` / `nameserverLoadError`. The banner renders while either is set; a successful reload clears only its own error; "keep previous rows on failure" is unchanged.
   - Both mixed-outcome orders are covered: cluster-fail + nameserver-success and nameserver-fail + cluster-success, plus a partial-recovery case (one loader recovers, the other still failing → banner stays; only when the failing side's own reload succeeds does it clear).
   - All 4 tests verified red against the trunk shared-flag source (`Unable to find role="alert"` — the success cleared the other's error), green with the fix: ClusterPage **33/33**; `tsc -b`, eslint, `npm run build` clean.
   
   Details in the PR description ("Per-loader error state" section). Ready for re-review.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): keep failed registry loads from silently emptying the tables [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4618:
URL: https://github.com/apache/rocketmq-dashboard/pull/4618#issuecomment-5963531002

   This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): keep failed registry loads from silently emptying the tables [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #4618: fix(cluster): keep failed registry loads from silently emptying the tables
URL: https://github.com/apache/rocketmq-dashboard/pull/4618


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): keep failed registry loads from silently emptying the tables [rocketmq-dashboard]

Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #4618:
URL: https://github.com/apache/rocketmq-dashboard/pull/4618#issuecomment-5751664486

   @/tmp/v4618.md


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org