dbwong commented on a change in pull request #771:
URL: https://github.com/apache/phoenix/pull/771#discussion_r416093640
##########
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:
We could but I'm not sure there is much benefit end client can't really
act differently. Is logging sufficient?
----------------------------------------------------------------
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]