keith-turner commented on a change in pull request #1487: Fixes: #1323 
Implement a write thread limit
URL: https://github.com/apache/accumulo/pull/1487#discussion_r396521852
 
 

 ##########
 File path: 
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
 ##########
 @@ -1005,19 +1012,37 @@ private void setUpdateTablet(UpdateSession us, 
KeyExtent keyExtent) {
         updateMetrics.addPermissionErrors(0);
         return;
       }
+
     }
 
     @Override
     public void applyUpdates(TInfo tinfo, long updateID, TKeyExtent tkeyExtent,
-        List<TMutation> tmutations) {
+        List<TMutation> tmutations) throws TException {
       UpdateSession us = (UpdateSession) 
sessionManager.reserveSession(updateID);
       if (us == null) {
         return;
       }
 
       boolean reserved = true;
+      boolean allowWriteThreadSemaphore = false;
       try {
         KeyExtent keyExtent = new KeyExtent(tkeyExtent);
+        maxThreads = 
getServerConfig().getConfiguration().getCount(Property.TSERV_MAX_WRITETHREADS);
+        maxThreadPermits = maxThreads == 0 ? Integer.MAX_VALUE : maxThreads;
+        sem = new Semaphore(maxThreadPermits);
 
 Review comment:
   The semaphore should be shared between function calls and thread.  This is 
continually creating new semaphores, so different threads will have different 
semaphores. With this pattern the semaphore object aquired from could change 
before the thread returns.  I I think it should be created once for the tserver.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to