Просмотр исходного кода

ZOOKEEPER-4710 Fix ZkUtil deleteInBatch() by releasing semaphore after set flag (#2020)

Yan Zhao 2 лет назад
Родитель
Сommit
77c1e4c872
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java

+ 1 - 1
zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java

@@ -109,10 +109,10 @@ public class ZKUtil {
         List<Op> ops = new ArrayList<>();
         List<Op> ops = new ArrayList<>();
         BatchedDeleteCbContext context = new BatchedDeleteCbContext(rateLimit);
         BatchedDeleteCbContext context = new BatchedDeleteCbContext(rateLimit);
         MultiCallback cb = (rc, path, ctx, opResults) -> {
         MultiCallback cb = (rc, path, ctx, opResults) -> {
-            ((BatchedDeleteCbContext) ctx).sem.release();
             if (rc != Code.OK.intValue()) {
             if (rc != Code.OK.intValue()) {
                 ((BatchedDeleteCbContext) ctx).success.set(false);
                 ((BatchedDeleteCbContext) ctx).success.set(false);
             }
             }
+            ((BatchedDeleteCbContext) ctx).sem.release();
         };
         };
 
 
         // Delete the leaves first and eventually get rid of the root
         // Delete the leaves first and eventually get rid of the root