Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.doris.catalog.FunctionSet;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.info.PartitionNamesInfo;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
Expand Down Expand Up @@ -753,7 +752,7 @@ public String apply(String s) {
sb.append(" NEGATIVE");
}
sb.append(" INTO TABLE ");
sb.append(isMysqlLoad ? ClusterNamespace.getNameFromFullName(dbName) + "." + tableName : tableName);
sb.append(isMysqlLoad ? dbName + "." + tableName : tableName);
if (partitionNamesInfo != null) {
sb.append(" ");
sb.append(partitionNamesInfo.toSql());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.doris.analysis;

import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
Expand Down Expand Up @@ -119,12 +118,6 @@ public void analyze() throws AnalysisException {
analyze(ctl);
}

private void removeClusterPrefix() {
if (db != null) {
db = ClusterNamespace.getNameFromFullName(db);
}
}

@Override
public boolean equals(Object obj) {
if (!(obj instanceof TablePattern)) {
Expand Down Expand Up @@ -155,7 +148,6 @@ public void write(DataOutput out) throws IOException {

@Override
public void gsonPostProcess() throws IOException {
removeClusterPrefix();
isAnalyzed = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.doris.analysis;

import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.CaseSensibility;
import org.apache.doris.common.FeNameFormat;
Expand Down Expand Up @@ -284,7 +283,7 @@ public TUserIdentity toThrift() {
// return default_role_rbac_username@host or default_role_rbac_username@[domain]
public String toDefaultRoleName() {
StringBuilder sb = new StringBuilder(
RoleManager.DEFAULT_ROLE_PREFIX + ClusterNamespace.getNameFromFullName(user) + "@");
RoleManager.DEFAULT_ROLE_PREFIX + user + "@");
if (isDomain) {
sb.append("[");
}
Expand All @@ -295,11 +294,6 @@ public String toDefaultRoleName() {
return sb.toString();
}

// should be remove after version 3.0
public void removeClusterPrefix() {
user = ClusterNamespace.getNameFromFullName(user);
}

public static UserIdentity read(DataInput in) throws IOException {
String json = Text.readString(in);
UserIdentity userIdentity = GsonUtils.GSON.fromJson(json, UserIdentity.class);
Expand Down Expand Up @@ -354,6 +348,5 @@ public void write(DataOutput out) throws IOException {
@Override
public void gsonPostProcess() throws IOException {
isAnalyzed = true;
removeClusterPrefix();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.apache.doris.catalog.TableIf.TableType;
import org.apache.doris.catalog.info.PartitionNamesInfo;
import org.apache.doris.cloud.backup.CloudRestoreJob;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.ErrorCode;
Expand Down Expand Up @@ -566,7 +565,7 @@ private void backup(Repository repository, Database db, BackupCommand command) t

// Create a backup job
BackupJob backupJob = new BackupJob(command.getLabel(), db.getId(),
ClusterNamespace.getNameFromFullName(db.getFullName()),
db.getFullName(),
tableRefInfoList, command.getTimeoutMs(), command.getContent(), env, repoId, commitSeq);
// write log
env.getEditLog().logBackupJob(backupJob);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.doris.catalog.TableIf.TableType;
import org.apache.doris.cloud.catalog.CloudEnv;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
Expand Down Expand Up @@ -246,8 +245,7 @@ public String getName() {
}

public void setNameWithoutLock(String newName) {
// ClusterNamespace.getNameFromFullName should be removed in 3.0
this.fullQualifiedName = ClusterNamespace.getNameFromFullName(newName);
this.fullQualifiedName = newName;
for (Table table : idToTable.values()) {
table.setQualifiedDbName(fullQualifiedName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.doris.catalog;

import org.apache.doris.alter.AlterCancelException;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.MetaNotFoundException;
import org.apache.doris.common.Pair;
Expand Down Expand Up @@ -313,7 +312,7 @@ default Partition getPartition(String name) {

default List<String> getFullQualifiers() {
return ImmutableList.of(getDatabase().getCatalog().getName(),
ClusterNamespace.getNameFromFullName(getDatabase().getFullName()),
getDatabase().getFullName(),
getName());
}

Expand All @@ -324,7 +323,7 @@ default String getNameWithFullQualifiers() {
return "null.null." + getName();
} else {
return db.getCatalog().getName()
+ "." + ClusterNamespace.getNameFromFullName(db.getFullName())
+ "." + db.getFullName()
+ "." + getName();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.apache.doris.analysis.ResourceTypeEnum;
import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.authorizer.ranger.RangerAccessController;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AuthorizationException;
import org.apache.doris.mysql.privilege.PrivBitSet;
import org.apache.doris.mysql.privilege.PrivPredicate;
Expand Down Expand Up @@ -76,7 +75,7 @@ private RangerAccessRequestImpl createRequest(UserIdentity currentUser, DorisAcc
@Override
protected RangerAccessRequestImpl createRequest(UserIdentity currentUser) {
RangerAccessRequestImpl request = new RangerAccessRequestImpl();
request.setUser(ClusterNamespace.getNameFromFullName(currentUser.getQualifiedUser()));
request.setUser(currentUser.getQualifiedUser());
request.setClientIPAddress(currentUser.getHost());
request.setClusterType(CLIENT_TYPE_DORIS);
request.setClientType(CLIENT_TYPE_DORIS);
Expand Down Expand Up @@ -176,13 +175,13 @@ public boolean checkDbPriv(UserIdentity currentUser, String ctl, String db, Priv
private boolean checkDbPrivInternal(UserIdentity currentUser, String ctl, String db, PrivPredicate wanted,
PrivBitSet checkedPrivs) {
RangerDorisResource resource = new RangerDorisResource(DorisObjectType.DATABASE, ctl,
ClusterNamespace.getNameFromFullName(db));
db);
return checkPrivilege(currentUser, wanted, resource, checkedPrivs);
}

private boolean checkAnyPrivWithinDb(UserIdentity currentUser, String ctl, String db) {
RangerDorisResource resource = new RangerDorisResource(DorisObjectType.DATABASE, ctl,
ClusterNamespace.getNameFromFullName(db));
db);
return checkShowPrivilegeByPlugin(currentUser, resource);
}

Expand All @@ -204,13 +203,13 @@ public boolean checkTblPriv(UserIdentity currentUser, String ctl, String db, Str
private boolean checkTblPrivInternal(UserIdentity currentUser, String ctl, String db, String tbl,
PrivPredicate wanted, PrivBitSet checkedPrivs) {
RangerDorisResource resource = new RangerDorisResource(DorisObjectType.TABLE,
ctl, ClusterNamespace.getNameFromFullName(db), tbl);
ctl, db, tbl);
return checkPrivilege(currentUser, wanted, resource, checkedPrivs);
}

private boolean checkAnyPrivWithinTbl(UserIdentity currentUser, String ctl, String db, String tbl) {
RangerDorisResource resource = new RangerDorisResource(DorisObjectType.TABLE,
ctl, ClusterNamespace.getNameFromFullName(db), tbl);
ctl, db, tbl);
return checkShowPrivilegeByPlugin(currentUser, resource);
}

Expand Down Expand Up @@ -238,7 +237,7 @@ public void checkColsPriv(UserIdentity currentUser, String ctl, String db, Strin
private boolean checkColPrivInternal(UserIdentity currentUser, String ctl, String db, String tbl, String col,
PrivPredicate wanted, PrivBitSet checkedPrivs) {
RangerDorisResource resource = new RangerDorisResource(DorisObjectType.COLUMN,
ctl, ClusterNamespace.getNameFromFullName(db), tbl, col);
ctl, db, tbl, col);
return checkPrivilege(currentUser, wanted, resource, checkedPrivs);
}

Expand Down Expand Up @@ -312,13 +311,13 @@ private boolean checkWorkloadGroupInternal(UserIdentity currentUser, String work
@Override
protected RangerDorisResource createResource(String ctl, String db, String tbl) {
return new RangerDorisResource(DorisObjectType.TABLE,
ctl, ClusterNamespace.getNameFromFullName(db), tbl);
ctl, db, tbl);
}

@Override
protected RangerDorisResource createResource(String ctl, String db, String tbl, String col) {
return new RangerDorisResource(DorisObjectType.COLUMN,
ctl, ClusterNamespace.getNameFromFullName(db), tbl, col);
ctl, db, tbl, col);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.authorizer.ranger.RangerAccessController;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AuthorizationException;
import org.apache.doris.common.ThreadPoolManager;
import org.apache.doris.datasource.InternalCatalog;
Expand Down Expand Up @@ -82,9 +81,9 @@ private RangerAccessRequestImpl createRequest(UserIdentity currentUser, HiveAcce
protected RangerAccessRequestImpl createRequest(UserIdentity currentUser) {
RangerAccessRequestImpl request = new RangerAccessRequestImpl();
String user = currentUser.getQualifiedUser();
request.setUser(ClusterNamespace.getNameFromFullName(user));
request.setUser(user);
Set<String> roles = Env.getCurrentEnv().getAuth().getRolesByUser(currentUser, false);
request.setUserRoles(roles.stream().map(role -> ClusterNamespace.getNameFromFullName(role)).collect(
request.setUserRoles(roles.stream().collect(
Collectors.toSet()));
request.setClientIPAddress(currentUser.getHost());
request.setClusterType(CLIENT_TYPE_DORIS);
Expand Down Expand Up @@ -152,14 +151,14 @@ public boolean checkCtlPriv(UserIdentity currentUser, String ctl, PrivPredicate
@Override
public boolean checkDbPriv(UserIdentity currentUser, String ctl, String db, PrivPredicate wanted) {
RangerHiveResource resource = new RangerHiveResource(HiveObjectType.DATABASE,
ClusterNamespace.getNameFromFullName(db));
db);
return checkPrivilege(currentUser, convertToAccessType(wanted), resource);
}

@Override
public boolean checkTblPriv(UserIdentity currentUser, String ctl, String db, String tbl, PrivPredicate wanted) {
RangerHiveResource resource = new RangerHiveResource(HiveObjectType.TABLE,
ClusterNamespace.getNameFromFullName(db), tbl);
db, tbl);
return checkPrivilege(currentUser, convertToAccessType(wanted), resource);
}

Expand All @@ -169,7 +168,7 @@ public void checkColsPriv(UserIdentity currentUser, String ctl, String db, Strin
List<RangerHiveResource> resources = new ArrayList<>();
for (String col : cols) {
RangerHiveResource resource = new RangerHiveResource(HiveObjectType.COLUMN,
ClusterNamespace.getNameFromFullName(db), tbl, col);
db, tbl, col);
resources.add(resource);
}

Expand Down Expand Up @@ -202,13 +201,13 @@ public boolean checkWorkloadGroupPriv(UserIdentity currentUser, String workloadG
@Override
protected RangerHiveResource createResource(String ctl, String db, String tbl) {
return new RangerHiveResource(HiveObjectType.TABLE,
ClusterNamespace.getNameFromFullName(db), tbl);
db, tbl);
}

@Override
protected RangerHiveResource createResource(String ctl, String db, String tbl, String col) {
return new RangerHiveResource(HiveObjectType.COLUMN,
ClusterNamespace.getNameFromFullName(db), tbl, col);
db, tbl, col);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ private List<Tablet> getHotTablets(String srcClusterName, String dstClusterName)
String dbName = tmp[0];
Long partitionId = Long.parseLong(line.get(2));
Long indexId = Long.parseLong(line.get(3));
Database db = Env.getCurrentInternalCatalog().getDbNullable("default_cluster:" + dbName);
Database db = Env.getCurrentInternalCatalog().getDbNullable(dbName);
if (db == null) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.apache.doris.cloud.rpc.MetaServiceProxy;
import org.apache.doris.cloud.storage.ObjectFile;
import org.apache.doris.cloud.system.CloudSystemInfoService;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.MetaNotFoundException;
Expand Down Expand Up @@ -1271,8 +1270,7 @@ public List<Cloud.StagePB> getStage(Cloud.StagePB.StageType stageType, String us
if (response.getStatus().getCode() == MetaServiceCode.STATE_ALREADY_EXISTED_FOR_USER
|| response.getStatus().getCode() == MetaServiceCode.STAGE_NOT_FOUND) {
Cloud.StagePB.Builder createStageBuilder = Cloud.StagePB.newBuilder();
createStageBuilder.addMysqlUserName(ClusterNamespace
.getNameFromFullName(ConnectContext.get().getCurrentUserIdentity().getQualifiedUser()))
createStageBuilder.addMysqlUserName(ConnectContext.get().getCurrentUserIdentity().getQualifiedUser())
.setStageId(UUID.randomUUID().toString())
.setType(Cloud.StagePB.StageType.INTERNAL).addMysqlUserId(userId);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.EnvFactory;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.CaseSensibility;
import org.apache.doris.common.DdlException;
Expand Down Expand Up @@ -444,7 +443,7 @@ public List<List<String>> showCreateCatalog(String catalogName) throws AnalysisE
throw new AnalysisException("No catalog found with name " + catalogName);
}
StringBuilder sb = new StringBuilder();
sb.append("\nCREATE CATALOG `").append(ClusterNamespace.getNameFromFullName(catalogName))
sb.append("\nCREATE CATALOG `").append(catalogName)
.append("`");
if (!Strings.isNullOrEmpty(catalog.getComment())) {
sb.append("\nCOMMENT \"").append(catalog.getComment()).append("\"\n");
Expand All @@ -459,7 +458,7 @@ public List<List<String>> showCreateCatalog(String catalogName) throws AnalysisE
sb.append("\n);");
}

rows.add(Lists.newArrayList(ClusterNamespace.getNameFromFullName(catalogName), sb.toString()));
rows.add(Lists.newArrayList(catalogName, sb.toString()));
} finally {
readUnlock();
}
Expand Down
Loading
Loading