gjacoby126 commented on a change in pull request #771:
URL: https://github.com/apache/phoenix/pull/771#discussion_r416684898
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
##########
@@ -4957,12 +4964,22 @@ private void
returnAllSequences(ConcurrentMap<SequenceKey,Sequence> sequenceMap)
public void addConnection(PhoenixConnection connection) throws
SQLException {
if (returnSequenceValues || shouldThrottleNumConnections) {
synchronized (connectionCountLock) {
- if (shouldThrottleNumConnections && connectionCount + 1 >
maxConnectionsAllowed){
- GLOBAL_PHOENIX_CONNECTIONS_THROTTLED_COUNTER.increment();
- throw new
SQLExceptionInfo.Builder(SQLExceptionCode.NEW_CONNECTION_THROTTLED).
- build().buildException();
+
+ if(shouldThrottleNumConnections) {
+ int futureConnections = 1 + (
connection.isInternalConnection() ? internalConnectionCount : connectionCount);
+ int allowedConnections = connection.isInternalConnection()
? maxInternalConnectionsAllowed : maxConnectionsAllowed;
+ if(allowedConnections != 0 && futureConnections >
allowedConnections) {
+
GLOBAL_PHOENIX_CONNECTIONS_THROTTLED_COUNTER.increment();
+ throw new
SQLExceptionInfo.Builder(SQLExceptionCode.NEW_CONNECTION_THROTTLED).
Review comment:
I can see a different error message being useful, because it keeps the
client developer from wasting a lot of time looking for a non-existent leak on
their side.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]