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 @@ -17,6 +17,7 @@

package org.apache.doris.qe;

import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.Env;
import org.apache.doris.common.ThreadPoolManager;
import org.apache.doris.common.util.DebugUtil;
Expand Down Expand Up @@ -173,10 +174,16 @@ public List<ConnectContext.ThreadInfo> listConnection(String user, boolean isFul
}

// used for thrift
public List<List<String>> listConnectionWithoutAuth(boolean isShowFullSql) {
public List<List<String>> listConnectionForRpc(UserIdentity userIdentity, boolean isShowFullSql) {
List<List<String>> list = new ArrayList<>();
long nowMs = System.currentTimeMillis();
for (ConnectContext ctx : connectionMap.values()) {
// Check auth
if (!ctx.getCurrentUserIdentity().equals(userIdentity) && !Env.getCurrentEnv()
.getAccessManager()
.checkGlobalPriv(userIdentity, PrivPredicate.GRANT)) {
continue;
}
list.add(ctx.toThreadInfo(isShowFullSql).toRow(-1, nowMs));
}
return list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ private void handleShowProcesslist() {
try {
TShowProcessListRequest request = new TShowProcessListRequest();
request.setShowFullSql(isShowFullSql);
request.setCurrentUserIdent(ConnectContext.get().getCurrentUserIdentity().toThrift());
List<Pair<String, Integer>> frontends = FrontendsProcNode.getFrontendWithRpcPort(Env.getCurrentEnv(),
false);
FrontendService.Client client = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3963,8 +3963,12 @@ public TShowProcessListResult showProcessList(TShowProcessListRequest request) {
if (request.isSetShowFullSql()) {
isShowFullSql = request.isShowFullSql();
}
UserIdentity userIdentity = UserIdentity.ROOT;
if (request.isSetCurrentUserIdent()) {
userIdentity = UserIdentity.fromThrift(request.getCurrentUserIdent());
}
List<List<String>> processList = ExecuteEnv.getInstance().getScheduler()
.listConnectionWithoutAuth(isShowFullSql);
.listConnectionForRpc(userIdentity, isShowFullSql);
TShowProcessListResult result = new TShowProcessListResult();
result.setProcessList(processList);
return result;
Expand Down
1 change: 1 addition & 0 deletions gensrc/thrift/FrontendService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@ struct TGetColumnInfoResult {

struct TShowProcessListRequest {
1: optional bool show_full_sql
2: optional Types.TUserIdentity current_user_ident
}

struct TShowProcessListResult {
Expand Down