Skip to content

[cleanup] Remove legacy ClusterNamespace class#61256

Merged
morrySnow merged 1 commit intoapache:masterfrom
morrySnow:rm-cluster
Mar 13, 2026
Merged

[cleanup] Remove legacy ClusterNamespace class#61256
morrySnow merged 1 commit intoapache:masterfrom
morrySnow:rm-cluster

Conversation

@morrySnow
Copy link
Contributor

Background

ClusterNamespace is a legacy artifact from the multi-tenancy era. In earlier versions, Apache Doris implemented multi-tenancy by prefixing database names with a cluster name using : as a separator. This functionality has since been completely removed, but the ClusterNamespace class and related legacy code remained.

Changes

  • Remove all ClusterNamespace.getNameFromFullName() calls (~122 call sites), replacing each with its original argument
  • Remove all import org.apache.doris.cluster.ClusterNamespace statements
  • Delete ClusterNamespace.java
  • Clean up dead code left behind (no-op self-assignments, stale comments like "should be removed in 3.0", empty removeClusterPrefix() methods)
  • Fix import ordering to satisfy checkstyle

Scope

60 files changed across:

  • Privilege/role management (Auth, Role, RoleManager, etc.)
  • Nereids commands (ShowCreateDatabase, ShowPartitions, etc.)
  • Ranger authorization (RangerDorisAccessController, RangerHiveAccessController)
  • Catalog/datasource (CatalogMgr, Database, InternalCatalog, etc.)
  • HTTP/REST handlers (BaseController, RestBaseController, etc.)
  • Backup/persistence (BackupHandler, DatabaseInfo, etc.)
  • Other modules (FrontendServiceImpl, ConnectContext, etc.)

Testing

  • FE compilation: ✅ BUILD SUCCESS
  • UserAuthenticationTest: ✅ 6/6 tests pass

@hello-stephen
Copy link
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
Copy link
Contributor Author

run buildall

@morrySnow
Copy link
Contributor Author

run buildall

@morrySnow
Copy link
Contributor Author

run buildall

@dataroaring
Copy link
Contributor

/review

dataroaring
dataroaring previously approved these changes Mar 12, 2026
Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Mar 12, 2026
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary: [cleanup] Remove legacy ClusterNamespace class

Overview

This PR cleanly removes the legacy ClusterNamespace class and all ~122 call sites of ClusterNamespace.getNameFromFullName(). The function was effectively a no-op (identity function) since multi-tenancy was removed and names no longer contain the ":" cluster prefix. The removal is correct and complete — no stray references remain.

Critical Checkpoint Conclusions

Goal & Correctness: The goal is to remove dead legacy code. The mechanical replacement of ClusterNamespace.getNameFromFullName(x) with x is correct since the method returned its argument unchanged when no : delimiter was present. FE compilation passes and existing tests pass. ✅

Modification Minimality: The change is focused on a single concern (removing ClusterNamespace). However, there are several places where redundant variable aliases were left behind (see nit comments). These don't affect correctness but reduce clarity. ⚠️ (minor)

Concurrency: No concurrency concerns — this is a pure code cleanup with no changes to shared state or locking. ✅

Lifecycle / Static Init: No lifecycle concerns. The deleted class had no static state that other classes depended on. ✅

Configuration Items: No configuration changes. ✅

Incompatible Changes / Rolling Upgrades: The removal of GsonPostProcessable.gsonPostProcess() from 6 persist classes (AlterDatabasePropertyInfo, CreateTableInfo, DatabaseInfo, DropDbInfo, PrivInfo, RecoverInfo) and 2 privilege classes (UserManager, RoleManager) means old persisted data containing "default_cluster:" prefixed names will no longer be stripped during deserialization. This is safe for any supported upgrade path, since the prefix was removed many versions ago and any intermediate version would have already stripped and re-persisted the data. Gson silently ignores the removed clusterName field in DatabaseInfo. ✅

Parallel Code Paths: The Database.getName() method still contains : splitting logic as a separate backward-compatibility mechanism — this is fine and not in scope of this PR. ✅

Test Coverage: The removed test testInfoSchemaWithClusterPrefixTriggersSpecialCheck was specifically testing the cluster-prefix scenario that no longer applies. Other privilege tests remain. ✅

Observability: No observability concerns. ✅

Transaction/Persistence: Covered above under rolling upgrades. ✅

Performance: No performance concerns — this removes unnecessary string processing. ✅

Other Issues: See inline comments for minor cleanup suggestions (trivial variable aliases left behind, identity method getFullDbName). None are blockers.

Verdict

No blocking issues found. The PR is a clean, safe removal of legacy dead code. The inline comments below are suggestions for optional further cleanup in this PR or a follow-up.

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17611	4513	4316	4316
q2	q3	10721	815	554	554
q4	4692	361	251	251
q5	7927	1218	1041	1041
q6	224	173	144	144
q7	817	839	670	670
q8	10685	1501	1322	1322
q9	6518	4808	4776	4776
q10	6298	1947	1648	1648
q11	452	267	236	236
q12	682	576	471	471
q13	18053	2929	2197	2197
q14	229	232	218	218
q15	q16	741	743	658	658
q17	745	858	447	447
q18	6361	5551	5380	5380
q19	1119	988	600	600
q20	558	497	374	374
q21	4733	1984	1487	1487
q22	403	305	274	274
Total cold run time: 99569 ms
Total hot run time: 27064 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4779	4582	4621	4582
q2	q3	3939	4368	3861	3861
q4	911	1192	785	785
q5	4061	4401	4429	4401
q6	183	181	141	141
q7	1793	1667	1542	1542
q8	2484	2724	2573	2573
q9	7509	7316	7388	7316
q10	3840	4127	3582	3582
q11	522	424	414	414
q12	491	591	438	438
q13	2707	3327	2321	2321
q14	425	419	282	282
q15	q16	728	765	722	722
q17	1192	1393	1407	1393
q18	7327	6851	6678	6678
q19	928	901	946	901
q20	2098	2190	1998	1998
q21	4032	3500	3331	3331
q22	475	415	374	374
Total cold run time: 50424 ms
Total hot run time: 47635 ms

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Mar 12, 2026
@doris-robot
Copy link

TPC-DS: Total hot run time: 153269 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 4d59ef8c7f02eb384fd18ebb7d950f7d58bb3f61, data reload: false

query5	4324	650	534	534
query6	327	228	205	205
query7	4222	474	270	270
query8	346	247	236	236
query9	8673	2741	2710	2710
query10	542	400	346	346
query11	7395	5924	5572	5572
query12	182	132	126	126
query13	1291	471	346	346
query14	5684	3863	3576	3576
query14_1	2808	2802	2835	2802
query15	221	201	188	188
query16	1019	480	491	480
query17	1104	722	626	626
query18	2456	457	348	348
query19	220	213	185	185
query20	134	134	129	129
query21	223	143	122	122
query22	5228	5077	4956	4956
query23	16788	15970	15591	15591
query23_1	16160	15778	16012	15778
query24	7722	1729	1296	1296
query24_1	1296	1282	1264	1264
query25	564	518	442	442
query26	1493	258	148	148
query27	2786	489	285	285
query28	4530	1841	1844	1841
query29	841	561	481	481
query30	316	254	209	209
query31	1364	1293	1219	1219
query32	81	75	70	70
query33	505	325	270	270
query34	941	911	541	541
query35	644	668	602	602
query36	1070	1114	1008	1008
query37	130	99	81	81
query38	2958	2936	2918	2918
query39	878	856	844	844
query39_1	814	838	820	820
query40	231	150	133	133
query41	63	60	58	58
query42	303	300	307	300
query43	241	244	224	224
query44	
query45	197	188	186	186
query46	885	984	591	591
query47	2108	2142	2042	2042
query48	311	322	228	228
query49	629	455	375	375
query50	676	282	218	218
query51	4213	4079	4042	4042
query52	287	289	288	288
query53	289	332	286	286
query54	291	264	270	264
query55	91	84	86	84
query56	302	317	305	305
query57	1364	1337	1260	1260
query58	283	274	274	274
query59	1351	1453	1269	1269
query60	328	344	319	319
query61	143	180	145	145
query62	617	586	539	539
query63	306	278	280	278
query64	5056	1251	1003	1003
query65	
query66	1463	467	353	353
query67	16264	16469	16439	16439
query68	
query69	388	301	284	284
query70	977	992	935	935
query71	328	306	298	298
query72	2751	2669	2470	2470
query73	545	545	339	339
query74	9968	9985	9785	9785
query75	2844	2770	2505	2505
query76	2303	1027	691	691
query77	366	401	321	321
query78	11188	11242	10686	10686
query79	2759	798	600	600
query80	1771	665	568	568
query81	562	279	254	254
query82	1001	155	117	117
query83	345	280	253	253
query84	258	128	114	114
query85	980	560	518	518
query86	408	305	293	293
query87	3117	3088	2972	2972
query88	3500	2621	2607	2607
query89	436	373	344	344
query90	2020	187	169	169
query91	165	159	136	136
query92	79	75	70	70
query93	1193	805	521	521
query94	643	318	277	277
query95	581	395	310	310
query96	640	515	227	227
query97	2485	2537	2410	2410
query98	236	222	239	222
query99	991	1001	925	925
Total cold run time: 237085 ms
Total hot run time: 153269 ms

@morrySnow
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17644	4565	4295	4295
q2	q3	10646	789	519	519
q4	4681	351	248	248
q5	7560	1185	1007	1007
q6	171	178	148	148
q7	775	856	675	675
q8	9305	1448	1330	1330
q9	4759	4654	4639	4639
q10	6237	1892	1668	1668
q11	465	276	234	234
q12	710	577	469	469
q13	18023	2928	2192	2192
q14	226	231	219	219
q15	q16	729	742	667	667
q17	706	854	431	431
q18	6009	5328	5352	5328
q19	1119	975	627	627
q20	551	500	398	398
q21	4357	1825	1416	1416
q22	334	288	241	241
Total cold run time: 95007 ms
Total hot run time: 26751 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4386	4303	4322	4303
q2	q3	3818	4296	3809	3809
q4	854	1163	765	765
q5	3986	4360	4287	4287
q6	174	175	141	141
q7	1721	1590	1499	1499
q8	2408	2635	2511	2511
q9	7165	7052	7051	7051
q10	3641	3891	3500	3500
q11	492	431	415	415
q12	488	576	446	446
q13	2533	3051	2254	2254
q14	268	284	263	263
q15	q16	680	732	684	684
q17	1091	1281	1307	1281
q18	7060	6704	6514	6514
q19	835	838	903	838
q20	2012	2117	1924	1924
q21	3862	3459	3236	3236
q22	474	420	394	394
Total cold run time: 47948 ms
Total hot run time: 46115 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 152760 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 8eecee013380be81dd50a903ec79aaad3c1e3a63, data reload: false

query5	4341	649	532	532
query6	330	243	224	224
query7	4204	476	266	266
query8	352	255	237	237
query9	8696	2706	2734	2706
query10	540	394	356	356
query11	7427	5813	5549	5549
query12	192	130	127	127
query13	1267	452	362	362
query14	6646	3810	3578	3578
query14_1	2815	2809	2825	2809
query15	206	193	178	178
query16	998	484	457	457
query17	1118	707	627	627
query18	2716	453	352	352
query19	221	207	184	184
query20	136	128	129	128
query21	226	144	124	124
query22	4949	5231	5086	5086
query23	15888	15551	15314	15314
query23_1	15403	15376	15442	15376
query24	7202	1629	1260	1260
query24_1	1242	1229	1277	1229
query25	563	497	456	456
query26	1237	269	159	159
query27	2750	485	288	288
query28	4445	1849	1853	1849
query29	867	589	504	504
query30	320	254	216	216
query31	1374	1284	1239	1239
query32	107	82	76	76
query33	522	353	292	292
query34	913	914	562	562
query35	636	684	598	598
query36	1082	1165	1028	1028
query37	147	103	87	87
query38	2987	2912	2909	2909
query39	888	873	855	855
query39_1	837	836	827	827
query40	282	153	142	142
query41	69	62	62	62
query42	316	323	305	305
query43	240	250	223	223
query44	
query45	194	191	183	183
query46	877	972	629	629
query47	2096	2141	2068	2068
query48	314	311	234	234
query49	632	488	385	385
query50	689	289	213	213
query51	4134	4074	4063	4063
query52	289	303	288	288
query53	295	342	282	282
query54	307	276	263	263
query55	100	89	84	84
query56	336	336	317	317
query57	1386	1326	1304	1304
query58	297	284	280	280
query59	1350	1495	1315	1315
query60	350	343	335	335
query61	154	148	153	148
query62	649	629	542	542
query63	313	285	281	281
query64	5006	1292	1009	1009
query65	
query66	1415	484	356	356
query67	16459	16509	16336	16336
query68	
query69	385	305	283	283
query70	980	909	950	909
query71	328	307	298	298
query72	2774	2685	2441	2441
query73	545	550	322	322
query74	9968	9948	9739	9739
query75	2848	2769	2447	2447
query76	2314	1021	674	674
query77	348	412	310	310
query78	11226	11367	10640	10640
query79	2591	796	616	616
query80	1824	624	536	536
query81	569	276	255	255
query82	1026	154	121	121
query83	386	266	245	245
query84	251	118	101	101
query85	912	493	471	471
query86	415	318	326	318
query87	3121	3130	2997	2997
query88	3503	2640	2637	2637
query89	427	371	353	353
query90	1973	178	175	175
query91	171	164	138	138
query92	78	80	73	73
query93	1523	872	495	495
query94	646	321	290	290
query95	584	391	317	317
query96	628	506	226	226
query97	2466	2485	2405	2405
query98	247	215	224	215
query99	989	1018	934	934
Total cold run time: 236314 ms
Total hot run time: 152760 ms

ClusterNamespace is a legacy artifact from the multi-tenancy era that
prefixed database names with cluster names using ':' as a separator.
This functionality was completely removed, but the class and ~122 call
sites remained.

Changes:
- Remove all ClusterNamespace.getNameFromFullName() calls, replacing
  each with its original argument
- Remove all import statements for ClusterNamespace
- Delete ClusterNamespace.java
- Clean up dead code left behind (no-op self-assignments, stale comments)

62 files changed across privilege/role management, Nereids commands,
Ranger authorization, catalog/datasource, HTTP/REST handlers,
backup/persistence, and other modules.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@morrySnow
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17619	4493	4336	4336
q2	q3	10638	793	518	518
q4	4683	371	269	269
q5	7541	1198	1007	1007
q6	173	187	149	149
q7	792	864	683	683
q8	9309	1432	1327	1327
q9	4754	4705	4719	4705
q10	6252	1914	1670	1670
q11	467	266	235	235
q12	712	578	477	477
q13	18075	2944	2185	2185
q14	240	228	215	215
q15	q16	754	733	658	658
q17	721	831	453	453
q18	6022	5429	5269	5269
q19	1134	978	595	595
q20	557	509	398	398
q21	4333	1850	1390	1390
q22	335	314	460	314
Total cold run time: 95111 ms
Total hot run time: 26853 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4877	4596	4579	4579
q2	q3	3874	4316	3833	3833
q4	859	1195	762	762
q5	4120	4450	4296	4296
q6	186	172	141	141
q7	1760	1651	1510	1510
q8	2501	2691	2572	2572
q9	7636	7340	7505	7340
q10	3794	4070	3661	3661
q11	520	439	438	438
q12	522	638	469	469
q13	2724	3110	2319	2319
q14	289	313	290	290
q15	q16	760	786	763	763
q17	1159	1299	1332	1299
q18	7208	6814	6606	6606
q19	924	861	901	861
q20	2079	2166	2051	2051
q21	3951	3508	3355	3355
q22	574	452	369	369
Total cold run time: 50317 ms
Total hot run time: 47514 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 153319 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 4878b68fecbf9d4e3edf4fe72375e405cce5a3ac, data reload: false

query5	4338	619	533	533
query6	319	236	221	221
query7	4224	480	271	271
query8	340	253	236	236
query9	8749	2793	2780	2780
query10	536	375	339	339
query11	7343	5935	5649	5649
query12	187	132	132	132
query13	1274	466	352	352
query14	5684	3879	3621	3621
query14_1	2896	2814	2888	2814
query15	225	196	176	176
query16	968	484	470	470
query17	1117	747	594	594
query18	2429	439	349	349
query19	209	201	177	177
query20	129	122	128	122
query21	222	144	119	119
query22	4709	4947	4755	4755
query23	16686	16136	15744	15744
query23_1	15939	15726	15728	15726
query24	7823	1777	1278	1278
query24_1	1225	1220	1250	1220
query25	538	468	425	425
query26	1235	301	152	152
query27	2757	461	294	294
query28	4517	1886	1884	1884
query29	835	566	475	475
query30	312	246	208	208
query31	1362	1279	1202	1202
query32	81	71	73	71
query33	489	322	277	277
query34	932	939	562	562
query35	628	701	602	602
query36	1100	1110	919	919
query37	133	96	84	84
query38	3016	2938	2892	2892
query39	884	881	854	854
query39_1	832	830	818	818
query40	231	150	134	134
query41	66	57	58	57
query42	304	299	291	291
query43	236	253	220	220
query44	
query45	192	188	182	182
query46	891	986	612	612
query47	2100	2146	2022	2022
query48	318	329	235	235
query49	629	459	412	412
query50	693	280	219	219
query51	4091	4220	4126	4126
query52	285	293	278	278
query53	289	339	285	285
query54	301	256	256	256
query55	92	85	80	80
query56	309	314	317	314
query57	1352	1339	1264	1264
query58	313	280	278	278
query59	1327	1430	1305	1305
query60	344	336	315	315
query61	145	146	145	145
query62	619	589	540	540
query63	323	289	280	280
query64	4955	1264	984	984
query65	
query66	1464	459	348	348
query67	16565	16502	16299	16299
query68	
query69	386	307	282	282
query70	938	993	975	975
query71	345	315	308	308
query72	2887	2846	2595	2595
query73	553	554	328	328
query74	9974	9962	9811	9811
query75	2874	2750	2496	2496
query76	2285	1028	712	712
query77	372	405	326	326
query78	11208	11418	10670	10670
query79	1138	818	598	598
query80	1305	667	532	532
query81	537	274	243	243
query82	1343	150	122	122
query83	343	267	250	250
query84	243	120	95	95
query85	986	474	439	439
query86	394	304	305	304
query87	3136	3133	2987	2987
query88	3538	2683	2676	2676
query89	417	373	349	349
query90	1736	182	178	178
query91	168	154	130	130
query92	81	75	71	71
query93	926	848	510	510
query94	516	318	277	277
query95	583	394	317	317
query96	640	522	226	226
query97	2472	2501	2414	2414
query98	243	221	214	214
query99	1026	1013	920	920
Total cold run time: 233208 ms
Total hot run time: 153319 ms

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 39.84% (51/128) 🎉
Increment coverage report
Complete coverage report

@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Mar 13, 2026
Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morrySnow morrySnow merged commit a14befc into apache:master Mar 13, 2026
28 of 30 checks passed
@morrySnow morrySnow deleted the rm-cluster branch March 13, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants