Skip to content

Commit

Permalink
[Refactor] Remove used code (#8880)
Browse files Browse the repository at this point in the history
  • Loading branch information
imay committed Jul 18, 2022
1 parent 517f50f commit 150dcad
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 51 deletions.
Expand Up @@ -155,7 +155,7 @@ private ArrayList<AddPartitionClause> getAddPartitionClause(Database db, OlapTab
// AnalysisException: keys.size is always equal to column.size, cannot reach this exception
// IllegalArgumentException: lb is greater than ub
LOG.warn("Error in gen addPartitionKeyRange. Error={}, db: {}, table: {}", e.getMessage(),
db.getFullName(), olapTable.getName());
db.getOriginName(), olapTable.getName());
continue;
}
for (Range<PartitionKey> partitionKeyRange : rangePartitionInfo.getIdToRange(false).values()) {
Expand Down Expand Up @@ -239,7 +239,7 @@ private ArrayList<DropPartitionClause> getDropPartitionClause(Database db, OlapT
// AnalysisException: keys.size is always equal to column.size, cannot reach this exception
// IllegalArgumentException: lb is greater than ub
LOG.warn("Error in gen reservePartitionKeyRange. Error={}, db: {}, table: {}", e.getMessage(),
db.getFullName(), olapTable.getName());
db.getOriginName(), olapTable.getName());
return dropPartitionClauses;
}
RangePartitionInfo info = (RangePartitionInfo) (olapTable.getPartitionInfo());
Expand Down
36 changes: 0 additions & 36 deletions fe/fe-core/src/main/java/com/starrocks/mysql/privilege/Auth.java
Expand Up @@ -1586,42 +1586,6 @@ public List<List<String>> getUserProperties(String qualifiedUser) {
}
}

public void dropUserOfCluster(String clusterName, boolean isReplay) {
writeLock();
try {
Set<UserIdentity> allUserIdents = getAllUserIdents(true);
for (UserIdentity userIdent : allUserIdents) {
if (userIdent.getQualifiedUser().startsWith(clusterName)) {
dropUserInternal(userIdent, isReplay);
}
}
} finally {
writeUnlock();
}
}

// user can enter a cluster, if it has any privs of database or table in this cluster.
public boolean checkCanEnterCluster(ConnectContext ctx, String clusterName) {
readLock();
try {
if (checkGlobalPriv(ctx, PrivPredicate.ALL)) {
return true;
}

if (dbPrivTable.hasClusterPriv(ctx, clusterName)) {
return true;
}

if (tablePrivTable.hasClusterPriv(ctx, clusterName)) {
return true;
}

return false;
} finally {
readUnlock();
}
}

private void initUser() {
try {
UserIdentity rootUser = new UserIdentity(ROOT_USER, "%");
Expand Down
Expand Up @@ -23,7 +23,6 @@

import com.starrocks.analysis.UserIdentity;
import com.starrocks.common.io.Text;
import com.starrocks.qe.ConnectContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -82,17 +81,6 @@ public boolean hasPriv(UserIdentity currentUser, PrivPredicate wanted) {
return false;
}

public boolean hasClusterPriv(ConnectContext ctx, String clusterName) {
Iterator<PrivEntry> iter = this.getFullReadOnlyIterator();
while (iter.hasNext()) {
DbPrivEntry dbPrivEntry = (DbPrivEntry) iter.next();
if (dbPrivEntry.getOrigDb().startsWith(clusterName)) {
return true;
}
}
return false;
}

@Override
public void write(DataOutput out) throws IOException {
if (!isClassNameWrote) {
Expand Down
Expand Up @@ -509,7 +509,7 @@ public List<List<Comparable>> getDbInfo() {
if (db == null) {
continue;
}
info.add(db.getFullName());
info.add(db.getOriginName());
infos.add(info);
}
return infos;
Expand Down

0 comments on commit 150dcad

Please sign in to comment.