zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1189318 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
Date Wed, 26 Oct 2011 17:09:51 GMT
Author: phunt
Date: Wed Oct 26 17:09:51 2011
New Revision: 1189318

URL: http://svn.apache.org/viewvc?rev=1189318&view=rev
Log:
ZOOKEEPER-1251. call checkSession at begin of PrepRequestProcessor.pRequest (Thomas Koch via
phunt)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1189318&r1=1189317&r2=1189318&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Wed Oct 26 17:09:51 2011
@@ -71,6 +71,9 @@ IMPROVEMENTS:
   ZOOKEEPER-1254. test correct watch handling with multi ops
   (Thomas Koch via phunt)
 
+  ZOOKEEPER-1251. call checkSession at begin of PrepRequestProcessor.pRequest
+  (Thomas Koch via phunt)
+
 Release 3.4.0 - 
 
 Non-backward compatible changes:

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java?rev=1189318&r1=1189317&r2=1189318&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java Wed
Oct 26 17:09:51 2011
@@ -294,7 +294,6 @@ public class PrepRequestProcessor extend
 
         switch (type) {
             case OpCode.create:
-                zks.sessionTracker.checkSession(request.sessionId, request.getOwner());
                 CreateRequest createRequest = (CreateRequest)record;
                 String path = createRequest.getPath();
                 int lastSlash = path.lastIndexOf('/');
@@ -348,7 +347,6 @@ public class PrepRequestProcessor extend
                 addChangeRecord(new ChangeRecord(request.getHdr().getZxid(), path, s, 0,
listACL));
                 break;
             case OpCode.delete:
-                zks.sessionTracker.checkSession(request.sessionId, request.getOwner());
                 DeleteRequest deleteRequest = (DeleteRequest)record;
                 path = deleteRequest.getPath();
                 lastSlash = path.lastIndexOf('/');
@@ -371,7 +369,6 @@ public class PrepRequestProcessor extend
                 addChangeRecord(new ChangeRecord(request.getHdr().getZxid(), path, null,
-1, null));
                 break;
             case OpCode.setData:
-                zks.sessionTracker.checkSession(request.sessionId, request.getOwner());
                 SetDataRequest setDataRequest = (SetDataRequest)record;
                 path = setDataRequest.getPath();
                 nodeRecord = getRecordForPath(path);
@@ -383,7 +380,6 @@ public class PrepRequestProcessor extend
                 addChangeRecord(nodeRecord);
                 break;
             case OpCode.setACL:
-                zks.sessionTracker.checkSession(request.sessionId, request.getOwner());
                 SetACLRequest setAclRequest = (SetACLRequest)record;
                 path = setAclRequest.getPath();
                 listACL = removeDuplicates(setAclRequest.getAcl());
@@ -430,7 +426,6 @@ public class PrepRequestProcessor extend
                         + Long.toHexString(request.sessionId));
                 break;
             case OpCode.check:
-                zks.sessionTracker.checkSession(request.sessionId, request.getOwner());
                 CheckVersionRequest checkVersionRequest = (CheckVersionRequest)record;
                 path = checkVersionRequest.getPath();
                 nodeRecord = getRecordForPath(path);
@@ -462,6 +457,10 @@ public class PrepRequestProcessor extend
         request.setTxn(null);
 
         try {
+            if(request.type != OpCode.createSession && request.type != OpCode.closeSession)
{
+                zks.sessionTracker.checkSession(request.sessionId, request.getOwner());
+            }
+
             switch (request.type) {
                 case OpCode.create:
                 CreateRequest createRequest = new CreateRequest();
@@ -555,19 +554,6 @@ public class PrepRequestProcessor extend
             case OpCode.closeSession:
                 pRequest2Txn(request.type, zks.getNextZxid(), request, null);
                 break;
-
-            //All the rest don't need to create a Txn - just verify session
-            case OpCode.sync:
-            case OpCode.exists:
-            case OpCode.getData:
-            case OpCode.getACL:
-            case OpCode.getChildren:
-            case OpCode.getChildren2:
-            case OpCode.ping:
-            case OpCode.setWatches:
-                zks.sessionTracker.checkSession(request.sessionId,
-                        request.getOwner());
-                break;
             }
         } catch (KeeperException e) {
             if (request.getHdr() != null) {



Mime
View raw message