[cleanup] Remove legacy ClusterNamespace class#61256
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
run buildall |
|
run buildall |
|
/review |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
There was a problem hiding this comment.
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.
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.
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/RestBaseController.java
Outdated
Show resolved
Hide resolved
TPC-H: Total hot run time: 27064 ms |
TPC-DS: Total hot run time: 153269 ms |
|
run buildall |
TPC-H: Total hot run time: 26751 ms |
TPC-DS: 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>
|
run buildall |
TPC-H: Total hot run time: 26853 ms |
TPC-DS: Total hot run time: 153319 ms |
FE UT Coverage ReportIncrement line coverage |
|
PR approved by at least one committer and no changes requested. |
Background
ClusterNamespaceis 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 theClusterNamespaceclass and related legacy code remained.Changes
ClusterNamespace.getNameFromFullName()calls (~122 call sites), replacing each with its original argumentimport org.apache.doris.cluster.ClusterNamespacestatementsClusterNamespace.javaremoveClusterPrefix()methods)Scope
60 files changed across:
Testing