morningman commented on a change in pull request #7936:
URL: https://github.com/apache/incubator-doris/pull/7936#discussion_r800157381



##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java
##########
@@ -96,50 +94,50 @@ public boolean submit(ConnectContext context) {
     }
 
     // Register one connection with its connection id.
-    public synchronized boolean registerConnection(ConnectContext ctx) {
-        if (numberConnection >= maxConnections) {
+    public boolean registerConnection(ConnectContext ctx) {
+        if (numberConnection.incrementAndGet() > maxConnections) {
+            numberConnection.decrementAndGet();
             return false;
         }
         // Check user
-        if (connByUser.get(ctx.getQualifiedUser()) == null) {
-            connByUser.put(ctx.getQualifiedUser(), new AtomicInteger(0));
-        }
-        int conns = connByUser.get(ctx.getQualifiedUser()).get();
+        connByUser.putIfAbsent(ctx.getQualifiedUser(), new AtomicInteger(0));
+        AtomicInteger conns = connByUser.get(ctx.getQualifiedUser());
         if (ctx.getIsTempUser()) {
-            if (conns >= LdapAuthenticate.getMaxConn()) {
+            if (conns.incrementAndGet() > LdapAuthenticate.getMaxConn()) {
+                conns.decrementAndGet();
+                numberConnection.decrementAndGet();
                 return false;
             }
-        } else if (conns >= 
ctx.getCatalog().getAuth().getMaxConn(ctx.getQualifiedUser())) {
+        } else if (conns.incrementAndGet() > 
ctx.getCatalog().getAuth().getMaxConn(ctx.getQualifiedUser())) {
+            conns.decrementAndGet();
+            numberConnection.decrementAndGet();

Review comment:
       why call `numberConnection.decrementAndGet();` here?

##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
##########
@@ -471,8 +471,9 @@ public void exec() throws Exception {
                     addressToBackendID.get(execBeAddr),
                     toBrpcHost(execBeAddr),
                     queryOptions.query_timeout * 1000);
-
-            LOG.info("dispatch query job: {} to {}", 
DebugUtil.printId(queryId), topParams.instanceExecParams.get(0).host);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("dispatch query job: {} to {}", 
DebugUtil.printId(queryId), topParams.instanceExecParams.get(0).host);

Review comment:
       Actually this log is useful when tracking a query. Does it really impact 
the performance?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to