From 49259b1cec0cab09df1aecdc739d45169e7073ae Mon Sep 17 00:00:00 2001 From: James Date: Wed, 25 Dec 2024 18:22:02 +0800 Subject: [PATCH] Add more log for Reach limit of connections --- .../java/org/apache/doris/qe/ConnectContext.java | 5 +++++ .../java/org/apache/doris/qe/ConnectScheduler.java | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java index bfbb15a7a7a783..f43d3b982b1dbb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java @@ -1345,4 +1345,9 @@ public void setMysqlHandshakePacket(MysqlHandshakePacket mysqlHandshakePacket) { public byte[] getAuthPluginData() { return mysqlHandshakePacket == null ? null : mysqlHandshakePacket.getAuthPluginData(); } + + @Override + public String toString() { + return getClass().getName() + "@" + Integer.toHexString(hashCode()) + ":" + qualifiedUser; + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java index f7b2e1790cae6c..1c6aec94216ee1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java @@ -93,8 +93,9 @@ public boolean submit(ConnectContext context) { // Register one connection with its connection id. public boolean registerConnection(ConnectContext ctx) { if (numberConnection.incrementAndGet() > maxConnections) { - LOG.info("Number connection {} has reach upper limit {}. Connection map : [{}]", - numberConnection.get(), maxConnections, connectionMap); + LOG.info("Number connection {} has reach upper limit {}. Connection map : [{}], " + + "connByUser: [{}], flightToken2ConnectionId: [{}]", + numberConnection.get(), maxConnections, connectionMap, connByUser, flightToken2ConnectionId); numberConnection.decrementAndGet(); return false; } @@ -102,8 +103,10 @@ public boolean registerConnection(ConnectContext ctx) { connByUser.putIfAbsent(ctx.getQualifiedUser(), new AtomicInteger(0)); AtomicInteger conns = connByUser.get(ctx.getQualifiedUser()); if (conns.incrementAndGet() > ctx.getEnv().getAuth().getMaxConn(ctx.getQualifiedUser())) { - LOG.info("User {}'s connection {} has reached upper limit {}. connByUser: [{}]", ctx.getQualifiedUser(), - conns.get(), ctx.getEnv().getAuth().getMaxConn(ctx.getQualifiedUser()), connByUser); + LOG.info("User {}'s connection {} has reached upper limit {}. numberConnection {}, " + + "Connection map : [{}], connByUser: [{}], flightToken2ConnectionId: [{}]", + ctx.getQualifiedUser(), conns.get(), ctx.getEnv().getAuth().getMaxConn(ctx.getQualifiedUser()), + numberConnection.get(), connectionMap, connByUser, flightToken2ConnectionId); conns.decrementAndGet(); numberConnection.decrementAndGet(); return false; @@ -187,6 +190,7 @@ public List> listConnectionForRpc(UserIdentity userIdentity, boolea if (!ctx.getCurrentUserIdentity().equals(userIdentity) && !Env.getCurrentEnv() .getAccessManager() .checkGlobalPriv(userIdentity, PrivPredicate.GRANT)) { + LOG.info("connection filtered by auth, {}", ctx); continue; } list.add(ctx.toThreadInfo(isShowFullSql).toRow(-1, nowMs));