Skip to content

[fix](cloud) Exclude decommissioning BE from BE selection#65221

Open
deardeng wants to merge 4 commits into
apache:masterfrom
deardeng:pick-decommission
Open

[fix](cloud) Exclude decommissioning BE from BE selection#65221
deardeng wants to merge 4 commits into
apache:masterfrom
deardeng:pick-decommission

Conversation

@deardeng

@deardeng deardeng commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Problem Summary: Cloud decommissioning backends can still be alive before they reach the final decommissioned state. These backends could still be selected by CloudReplica routing, routine load assignment, and Kafka proxy backend selection. This change treats decommissioning backends the same as decommissioned backends in those selection paths, while preserving current master behavior such as direct multi-replica hashing and routine load blacklist stale-backend cleanup.

Release note

Cloud backend selection avoids routing new replica, routine load, and Kafka proxy work to decommissioning backends.

Check List (For Author)

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Cloud decommissioning backends can still be alive before they reach the final decommissioned state. These backends could still be selected by CloudReplica routing, routine load assignment, and Kafka proxy backend selection. This change treats decommissioning backends the same as decommissioned backends in those selection paths, while preserving current master behavior such as direct multi-replica hashing and routine load blacklist stale-backend cleanup.

### Release note

Cloud backend selection avoids routing new replica, routine load, and Kafka proxy work to decommissioning backends.

### Check List (For Author)

- Test: Unit Test

    - ./run-fe-ut.sh --run org.apache.doris.cloud.catalog.CloudReplicaTest,org.apache.doris.cloud.load.CloudRoutineLoadManagerTest,org.apache.doris.datasource.kafka.KafkaUtilTest,org.apache.doris.load.routineload.RoutineLoadTaskSchedulerTest

    - mvn checkstyle:check -pl fe-core

    - git diff --cached --check

- Behavior changed: Yes. Cloud BE selection now excludes decommissioning/decommissioned backends in the affected routing and load paths.

- Does this need documentation: No
@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?

@deardeng

deardeng commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@deardeng

deardeng commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

run buildall

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.
Workflow run: https://github.com/apache/doris/actions/runs/28746983595

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29334 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit f0a5bdbdefc900eb97017607cf9a9a1939f6ab2b, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17684	4074	3994	3994
q2	1982	314	189	189
q3	10404	1389	796	796
q4	4674	463	333	333
q5	7512	852	558	558
q6	185	171	139	139
q7	754	852	632	632
q8	9731	1594	1531	1531
q9	5931	4395	4383	4383
q10	6828	1784	1537	1537
q11	507	353	309	309
q12	729	557	431	431
q13	18098	3279	2725	2725
q14	274	252	236	236
q15	q16	787	781	703	703
q17	1875	1178	910	910
q18	6894	5679	5644	5644
q19	1612	1247	1086	1086
q20	744	676	517	517
q21	5897	2552	2380	2380
q22	429	357	301	301
Total cold run time: 103531 ms
Total hot run time: 29334 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4362	4247	4272	4247
q2	280	313	206	206
q3	4566	4919	4404	4404
q4	2037	2143	1337	1337
q5	4457	4314	4316	4314
q6	222	173	126	126
q7	1783	2116	1611	1611
q8	2422	2189	2079	2079
q9	7833	7921	7788	7788
q10	4727	4694	4248	4248
q11	561	403	376	376
q12	942	753	530	530
q13	3300	3516	3021	3021
q14	305	329	282	282
q15	q16	714	736	648	648
q17	1349	1313	1316	1313
q18	7878	7426	7108	7108
q19	1110	1106	1093	1093
q20	2210	2192	1939	1939
q21	5218	4514	4377	4377
q22	514	447	402	402
Total cold run time: 56790 ms
Total hot run time: 51449 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 174858 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit f0a5bdbdefc900eb97017607cf9a9a1939f6ab2b, data reload: false

query5	4358	649	518	518
query6	471	249	225	225
query7	4856	617	347	347
query8	365	216	194	194
query9	8797	4100	4072	4072
query10	467	369	324	324
query11	5888	2388	2157	2157
query12	162	107	104	104
query13	1308	640	426	426
query14	6347	5325	4998	4998
query14_1	4345	4352	4305	4305
query15	217	208	191	191
query16	1031	491	470	470
query17	1170	763	637	637
query18	2511	520	388	388
query19	235	209	170	170
query20	118	115	111	111
query21	239	171	141	141
query22	13566	13538	13373	13373
query23	17367	16423	16175	16175
query23_1	16240	16244	16307	16244
query24	7477	1785	1298	1298
query24_1	1357	1332	1302	1302
query25	613	545	440	440
query26	1359	380	216	216
query27	2572	638	397	397
query28	4934	2034	2046	2034
query29	1155	709	570	570
query30	348	272	231	231
query31	1132	1132	1016	1016
query32	123	71	71	71
query33	595	356	294	294
query34	1229	1240	694	694
query35	803	813	708	708
query36	1402	1417	1211	1211
query37	165	115	101	101
query38	1873	1716	1656	1656
query39	944	915	884	884
query39_1	879	885	925	885
query40	258	163	155	155
query41	80	79	78	78
query42	99	97	93	93
query43	325	327	284	284
query44	1441	798	776	776
query45	204	192	181	181
query46	1084	1228	738	738
query47	2366	2336	2251	2251
query48	419	446	314	314
query49	617	436	340	340
query50	1070	441	341	341
query51	4459	4520	4331	4331
query52	90	89	80	80
query53	278	286	212	212
query54	302	251	239	239
query55	77	75	70	70
query56	311	315	302	302
query57	1434	1454	1329	1329
query58	302	264	262	262
query59	1552	1645	1427	1427
query60	333	281	265	265
query61	195	188	191	188
query62	708	655	594	594
query63	247	211	208	208
query64	2648	881	711	711
query65	4860	4794	4786	4786
query66	1865	571	432	432
query67	29640	29461	29191	29191
query68	3349	1602	983	983
query69	429	314	279	279
query70	1079	959	963	959
query71	361	320	318	318
query72	3329	2996	2618	2618
query73	842	760	439	439
query74	5134	5002	4743	4743
query75	2646	2603	2240	2240
query76	2318	1185	805	805
query77	369	397	295	295
query78	12521	12452	11899	11899
query79	1366	1212	755	755
query80	698	579	487	487
query81	465	328	291	291
query82	562	160	131	131
query83	413	327	308	308
query84	304	171	139	139
query85	1040	708	635	635
query86	364	301	282	282
query87	1842	1815	1730	1730
query88	3767	2870	2862	2862
query89	457	413	362	362
query90	1978	204	193	193
query91	227	217	189	189
query92	69	64	62	62
query93	1607	1587	969	969
query94	575	377	329	329
query95	831	505	581	505
query96	1124	845	357	357
query97	2701	2678	2540	2540
query98	218	211	201	201
query99	1196	1156	1045	1045
Total cold run time: 260910 ms
Total hot run time: 174858 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.04 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit f0a5bdbdefc900eb97017607cf9a9a1939f6ab2b, data reload: false

query1	0.01	0.01	0.00
query2	0.09	0.05	0.05
query3	0.28	0.13	0.13
query4	1.60	0.14	0.13
query5	0.23	0.22	0.21
query6	1.27	1.03	1.07
query7	0.03	0.00	0.00
query8	0.06	0.04	0.04
query9	0.38	0.31	0.32
query10	0.59	0.53	0.55
query11	0.19	0.14	0.14
query12	0.17	0.14	0.15
query13	0.46	0.46	0.47
query14	1.00	1.00	0.98
query15	0.61	0.58	0.57
query16	0.33	0.33	0.31
query17	1.06	1.13	1.09
query18	0.23	0.21	0.21
query19	2.02	1.89	1.95
query20	0.02	0.01	0.01
query21	15.42	0.22	0.13
query22	4.80	0.05	0.05
query23	16.16	0.31	0.12
query24	2.94	0.41	0.33
query25	0.11	0.05	0.04
query26	0.73	0.21	0.15
query27	0.04	0.03	0.04
query28	3.57	0.95	0.52
query29	12.52	4.41	3.49
query30	0.26	0.14	0.15
query31	2.77	0.58	0.32
query32	3.22	0.59	0.50
query33	3.14	3.23	3.24
query34	15.50	4.27	3.47
query35	3.55	3.53	3.51
query36	0.55	0.44	0.42
query37	0.08	0.06	0.07
query38	0.06	0.03	0.03
query39	0.04	0.03	0.03
query40	0.18	0.16	0.15
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.44 s
Total hot run time: 25.04 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 25.00% (10/40) 🎉
Increment coverage report
Complete coverage report

@deardeng

deardeng commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot 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.

Review summary for PR 65221

I found no substantiated issue requiring inline comments.

Critical checkpoint conclusions:

  • Goal and behavior: the patch consistently excludes decommissioning/decommissioned cloud backends from the changed CloudReplica routing, cloud routine-load backend assignment, routine-load submit guard, and Kafka proxy backend selection paths while preserving the existing fallback behavior when only decommissioned backends remain.
  • Scope: the implementation is focused on backend selection predicates plus targeted unit coverage.
  • Concurrency/lifecycle: no new shared lifecycle state is introduced; the changed code reads existing Backend state during selection and submit-time validation.
  • Config/session propagation: no new config items or session variables are added.
  • Compatibility/persistence/protocol: no storage format, edit-log, Thrift, or rolling-upgrade protocol change was introduced.
  • Parallel paths: checked colocate, primary/secondary cached replica selection, multi-replica hashing, routine-load allocation/submit, and Kafka blacklist fallback paths. I also checked Kinesis metadata selection as a nearby parallel helper; Kinesis routine load rejects cloud mode, so it is not a missed cloud decommissioning path for this PR.
  • Tests: the added/updated unit tests cover the changed decommissioning filters for CloudReplica, CloudRoutineLoadManager, KafkaUtil, and RoutineLoadTaskScheduler. I did not run the FE unit tests because this runner is missing thirdparty/installed/bin/protoc, which the FE AGENTS instructions require before build/test execution.
  • Observability/performance: the added debug logging is guarded by isDebugEnabled, and the new filters do not add a concerning cost beyond existing backend-list scans.

User focus: no additional user-provided review focus was present.

Subagent conclusions:

  • optimizer-rewrite: no candidates in the initial pass; convergence round C1 returned NO_NEW_VALUABLE_FINDINGS for the final empty inline comment set.
  • tests-session-config: no candidates in the initial pass; convergence round C1 returned NO_NEW_VALUABLE_FINDINGS for the final empty inline comment set.
  • No subagent candidates were accepted, dismissed, or merged as duplicates because none were appended to the shared ledger.

Validation performed:

  • Loaded the review prompt, repo code-review skill, required AGENTS files, existing review thread/comment context, review focus, changed-file list, and shared ledger before diff inspection.
  • Used GitHub PR metadata and patch data as the authoritative scope for the shallow checkout.
  • Ran git diff --check FETCH_HEAD HEAD over the eight PR files; it passed with no output.

deardeng and others added 2 commits July 6, 2026 11:21
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Routine load backend selection treated decommissioning backends as unavailable in all deploy modes. In shared-nothing mode this could prevent routine load tasks or Kafka meta lookup from using an otherwise load-available backend. This change only filters decommissioning backends in cloud mode and keeps the Kafka meta blacklist fallback available while still removing stale blacklist entries.

### Release note

Routine load backend selection no longer excludes decommissioning backends outside cloud mode.

### Check List (For Author)

- Test: Unit Test

    - ./run-fe-ut.sh --run org.apache.doris.datasource.kafka.KafkaUtilTest,org.apache.doris.load.routineload.RoutineLoadTaskSchedulerTest

    - cd fe && mvn checkstyle:check -pl fe-core

- Behavior changed: Yes. Decommissioning backends remain eligible for routine load backend selection outside cloud mode.

- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Cloud routine load filtered candidate backends by Backend.isDecommissioning() unconditionally. The decommissioning state should only affect cloud mode, matching other load backend selection paths. This change guards the decommissioning check with Config.isCloudMode() so non-cloud paths do not exclude backends based on this cloud-only state while cloud mode behavior is unchanged.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - git diff --check
    - cd fe && mvn checkstyle:check -pl fe-core
- Behavior changed: Yes. Non-cloud mode no longer filters routine load candidate backends by the cloud-only decommissioning state.
- Does this need documentation: No
@deardeng

deardeng commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

run buildall

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: The branch included routine load and Kafka backend selection changes in CloudRoutineLoadManager, KafkaUtil, and RoutineLoadTaskScheduler, along with their unit tests. These changes are now covered by another PR, so this commit removes them from this branch and leaves the CloudReplica change as the remaining scope.

### Release note

None

### Check List (For Author)

- Test: Unit Test / Manual test
    - git diff --check
    - cd fe && mvn checkstyle:check -pl fe-core
    - ./run-fe-ut.sh --run org.apache.doris.cloud.catalog.CloudReplicaTest
- Behavior changed: No. This removes duplicate changes from this PR branch.
- Does this need documentation: No
@deardeng

deardeng commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29551 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit bfe3af6b5597c0aedba5e9c38f12a882fffec0eb, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17775	3959	3979	3959
q2	2067	328	200	200
q3	10217	1436	886	886
q4	4689	477	338	338
q5	7624	876	578	578
q6	180	170	133	133
q7	762	844	632	632
q8	9345	1604	1598	1598
q9	5562	4398	4385	4385
q10	6783	1782	1553	1553
q11	499	350	310	310
q12	725	552	434	434
q13	18092	3452	2713	2713
q14	275	259	238	238
q15	q16	788	769	708	708
q17	1012	1024	1063	1024
q18	7027	5762	5530	5530
q19	1353	1235	1052	1052
q20	726	623	542	542
q21	5916	2674	2437	2437
q22	430	357	301	301
Total cold run time: 101847 ms
Total hot run time: 29551 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4327	4278	4261	4261
q2	281	318	206	206
q3	4623	4968	4405	4405
q4	2057	2163	1362	1362
q5	4406	4259	4307	4259
q6	229	178	126	126
q7	1769	1907	1857	1857
q8	2538	2165	2194	2165
q9	8043	8202	7858	7858
q10	4778	4695	4258	4258
q11	555	409	395	395
q12	745	776	551	551
q13	3197	3596	3023	3023
q14	283	302	269	269
q15	q16	716	742	640	640
q17	1335	1332	1409	1332
q18	7669	7214	7428	7214
q19	1185	1141	1103	1103
q20	2220	2203	1926	1926
q21	5247	4501	4392	4392
q22	517	488	394	394
Total cold run time: 56720 ms
Total hot run time: 51996 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 173994 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit bfe3af6b5597c0aedba5e9c38f12a882fffec0eb, data reload: false

query5	4325	627	491	491
query6	463	213	192	192
query7	4871	609	358	358
query8	335	196	178	178
query9	8768	4077	4091	4077
query10	456	343	313	313
query11	5899	2346	2128	2128
query12	161	104	110	104
query13	1283	602	436	436
query14	6272	5322	5003	5003
query14_1	4323	4303	4324	4303
query15	220	204	181	181
query16	994	463	457	457
query17	966	754	590	590
query18	2442	487	354	354
query19	210	193	155	155
query20	113	109	106	106
query21	232	160	137	137
query22	13647	13526	13449	13449
query23	17501	16712	16210	16210
query23_1	16299	16193	16286	16193
query24	7818	1778	1336	1336
query24_1	1322	1303	1345	1303
query25	678	467	411	411
query26	1357	348	215	215
query27	2645	590	393	393
query28	4525	2079	2041	2041
query29	1121	647	498	498
query30	336	260	223	223
query31	1130	1104	982	982
query32	116	66	64	64
query33	581	308	251	251
query34	1192	1171	650	650
query35	759	774	666	666
query36	1389	1343	1241	1241
query37	156	111	93	93
query38	1883	1703	1671	1671
query39	933	912	885	885
query39_1	882	893	881	881
query40	242	154	137	137
query41	64	63	64	63
query42	95	95	91	91
query43	312	331	277	277
query44	1461	800	787	787
query45	213	192	182	182
query46	1050	1167	736	736
query47	2404	2347	2235	2235
query48	408	424	296	296
query49	587	419	317	317
query50	1073	432	346	346
query51	4426	4424	4377	4377
query52	83	85	73	73
query53	253	277	210	210
query54	279	233	218	218
query55	76	71	66	66
query56	287	316	286	286
query57	1399	1410	1316	1316
query58	277	255	252	252
query59	1605	1631	1384	1384
query60	310	269	245	245
query61	150	150	148	148
query62	715	638	585	585
query63	249	210	213	210
query64	2587	759	626	626
query65	4891	4756	4810	4756
query66	1826	514	386	386
query67	29599	29474	29388	29388
query68	3064	1561	970	970
query69	411	292	258	258
query70	1102	1016	962	962
query71	346	302	329	302
query72	2832	2588	2333	2333
query73	880	765	430	430
query74	5113	4975	4809	4809
query75	2619	2591	2218	2218
query76	2326	1221	799	799
query77	363	406	291	291
query78	12363	12579	11843	11843
query79	1209	1201	779	779
query80	618	550	464	464
query81	462	323	277	277
query82	241	161	123	123
query83	313	321	296	296
query84	306	160	129	129
query85	902	625	498	498
query86	336	306	276	276
query87	1812	1826	1735	1735
query88	3774	2829	2839	2829
query89	443	446	356	356
query90	2202	206	199	199
query91	204	190	155	155
query92	66	62	59	59
query93	1544	1557	998	998
query94	539	359	329	329
query95	764	476	460	460
query96	1028	839	341	341
query97	2654	2667	2607	2607
query98	241	207	196	196
query99	1169	1141	1025	1025
Total cold run time: 258191 ms
Total hot run time: 173994 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.19 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit bfe3af6b5597c0aedba5e9c38f12a882fffec0eb, data reload: false

query1	0.00	0.00	0.00
query2	0.10	0.05	0.05
query3	0.26	0.14	0.16
query4	1.63	0.14	0.14
query5	0.23	0.23	0.22
query6	1.29	1.07	1.05
query7	0.04	0.01	0.00
query8	0.05	0.04	0.03
query9	0.38	0.31	0.32
query10	0.55	0.58	0.54
query11	0.20	0.14	0.14
query12	0.18	0.14	0.15
query13	0.46	0.47	0.46
query14	1.01	0.99	1.02
query15	0.61	0.58	0.58
query16	0.32	0.33	0.31
query17	1.07	1.13	1.10
query18	0.22	0.21	0.21
query19	2.09	1.96	1.97
query20	0.01	0.01	0.01
query21	15.46	0.24	0.14
query22	4.77	0.06	0.06
query23	16.16	0.31	0.12
query24	2.93	0.43	0.31
query25	0.10	0.05	0.05
query26	0.73	0.20	0.16
query27	0.05	0.04	0.03
query28	3.51	0.94	0.52
query29	12.47	4.28	3.45
query30	0.27	0.15	0.15
query31	2.77	0.60	0.31
query32	3.22	0.59	0.48
query33	3.30	3.24	3.22
query34	15.67	4.19	3.52
query35	3.54	3.51	3.52
query36	0.55	0.41	0.42
query37	0.08	0.06	0.07
query38	0.05	0.04	0.04
query39	0.03	0.03	0.03
query40	0.17	0.16	0.16
query41	0.09	0.03	0.03
query42	0.04	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 96.7 s
Total hot run time: 25.19 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 18.18% (4/22) 🎉
Increment coverage report
Complete coverage report

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.

2 participants