Skip to content

Commit

Permalink
[Enhancement] Add node info in error msg when connection limit reached (
Browse files Browse the repository at this point in the history
#45445)

Signed-off-by: Dejun Xia <xiadejun@starrocks.com>
  • Loading branch information
nshangyiming committed May 11, 2024
1 parent 5470bb1 commit dc2bcdb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public boolean submit(ConnectContext context) {
public Pair<Boolean, String> registerConnection(ConnectContext ctx) {
if (numberConnection.get() >= maxConnections.get()) {
return new Pair<>(false, "Reach cluster-wide connection limit, qe_max_connection=" + maxConnections +
", connectionMap.size=" + connectionMap.size());
", connectionMap.size=" + connectionMap.size() +
", node=" + ctx.getGlobalStateMgr().getNodeMgr().getSelfNode());
}
// Check user
connByUser.computeIfAbsent(ctx.getQualifiedUser(), k -> new AtomicInteger(0));
Expand All @@ -133,7 +134,8 @@ public Pair<Boolean, String> registerConnection(ConnectContext ctx) {
return new Pair<>(false, "Reach user-level(qualifiedUser: " + ctx.getQualifiedUser() +
", currUserIdentity: " + ctx.getCurrentUserIdentity() + ") connection limit, " +
"currentUserMaxConn=" + currentUserMaxConn + ", connectionMap.size=" + connectionMap.size() +
", connByUser.totConn=" + connByUser.values().stream().mapToInt(AtomicInteger::get).sum());
", connByUser.totConn=" + connByUser.values().stream().mapToInt(AtomicInteger::get).sum() +
", node=" + ctx.getGlobalStateMgr().getNodeMgr().getSelfNode());
}
numberConnection.incrementAndGet();
connByUser.get(ctx.getQualifiedUser()).incrementAndGet();
Expand Down

0 comments on commit dc2bcdb

Please sign in to comment.