zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] eolivelli commented on a change in pull request #959: ZOOKEEPER-3402: Add multiRead operation
Date Fri, 31 May 2019 16:38:50 GMT
eolivelli commented on a change in pull request #959: ZOOKEEPER-3402: Add multiRead operation
URL: https://github.com/apache/zookeeper/pull/959#discussion_r289464258
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java
 ##########
 @@ -1895,23 +1897,33 @@ private Op withRootPrefix(Op op) {
 
     protected void multiInternal(MultiTransactionRecord request, MultiCallback cb, Object
ctx) {
         RequestHeader h = new RequestHeader();
-        h.setType(ZooDefs.OpCode.multi);
+        switch (request.getOpKind()) {
+            case TRANSACTION: h.setType(ZooDefs.OpCode.multi); break;
+            case READ: h.setType(ZooDefs.OpCode.multiRead); break;
+        }
         MultiResponse response = new MultiResponse();
         cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, null, null, ctx, null);
     }
 
     protected List<OpResult> multiInternal(MultiTransactionRecord request)
         throws InterruptedException, KeeperException {
         RequestHeader h = new RequestHeader();
-        h.setType(ZooDefs.OpCode.multi);
+        switch (request.getOpKind()) {
+            case TRANSACTION: h.setType(ZooDefs.OpCode.multi); break;
+            case READ: h.setType(ZooDefs.OpCode.multiRead); break;
+        }
         MultiResponse response = new MultiResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
             throw KeeperException.create(KeeperException.Code.get(r.getErr()));
         }
 
         List<OpResult> results = response.getResultList();
-        
+        // In case of only read operations there is no need to throw an exception
+        // as the subResults are still possibly valid.
+        if(request.getOpKind() == Op.OpKind.READ)
 
 Review comment:
   Nit add brackets

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


With regards,
Apache Git Services

Mime
View raw message