Skip to content

[fix](fe) Fix SHOW BACKENDS field order mismatch#64005

Closed
HappenLee wants to merge 5 commits into
apache:branch-3.1from
HappenLee:branch-3.1
Closed

[fix](fe) Fix SHOW BACKENDS field order mismatch#64005
HappenLee wants to merge 5 commits into
apache:branch-3.1from
HappenLee:branch-3.1

Conversation

@HappenLee

Copy link
Copy Markdown
Contributor

Summary

Fix the output field order of SHOW BACKENDS command. The fields in BackendsProcDir.getBackendInfos() were out of sync with the BackendsTableValuedFunction.SCHEMA definition, causing incorrect column values to be displayed:

  • CpuCores column showed NodeRole value (mix)
  • Memory column showed CpuCores value
  • NodeRole column showed Memory value

Changes

  1. BackendsProcDir.java: Reorder TITLE_NAMES and getBackendInfos() output to match SCHEMA: CpuCores -> Memory -> RunningTasks -> NodeRole
  2. BackendsProcDirTest.java: Add unit test testBackendInfoFieldOrder to verify the correct field order
  3. DemoMultiBackendsTest.java: Fix NodeRole assertion column index after the field reorder (from size-4 to size-1)

Test plan

  • Unit test testBackendInfoFieldOrder verifies CpuCores < Memory < RunningTasks < NodeRole order
  • DemoMultiBackendsTest assertion index updated to match new field order

HappenLee and others added 4 commits June 2, 2026 14:05
The output fields of SHOW BACKENDS command were not in the same order as
the BackendsTableValuedFunction.SCHEMA definition, causing field values
to be displayed in wrong columns.

Issue:
- CpuCores showed NodeRole value (mix)
- Memory showed CpuCores value
- NodeRole showed Memory value

Fix:
- Reorder fields in BackendsProcDir.getBackendInfos() to match SCHEMA:
  CpuCores -> Memory -> LiveSince -> RunningTasks -> NodeRole
- Synchronize the same fix in MetadataGenerator.backendsMetadataResult()
- Add unit test to verify field order

Test: Unit test added
…BackendsTest

Issue Number: N/A

Problem Summary: After commit d21be2b which fixed SHOW BACKENDS field order
to match SCHEMA definition, the NodeRole column moved from index size-5 to
size-1 (last column). The test assertion still used the old wrong offset
size-5 (which now points to CpuCores returning "1"), causing the test to fail
with expected:<[mix]> but was:<[1]>.

None

- Test: Unit test fix - updated column index to match corrected field order
- Behavior changed: No
- Does this need documentation: No
TITLE_NAMES must be reordered to match getBackendInfos() after NodeRole
field was moved to the end. Also remove LiveSince assertion from test
since branch-3.1 does not have the LiveSince column.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HappenLee HappenLee requested a review from morrySnow as a code owner June 2, 2026 07:13
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@morrySnow morrySnow closed this Jun 2, 2026
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.

3 participants