Github user anmolnar commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/447#discussion_r160972325
--- Diff: src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java ---
@@ -1187,13 +1187,8 @@ private ProcessTxnResult processTxn(Request request,
TxnHeader hdr,
if (opCode == OpCode.createSession) {
if (hdr != null && txn instanceof CreateSessionTxn) {
CreateSessionTxn cst = (CreateSessionTxn) txn;
- sessionTracker.addGlobalSession(sessionId,
cst.getTimeOut());
- } else if (request != null && request.isLocalSession()) {
- request.request.rewind();
- int timeout = request.request.getInt();
- request.request.rewind();
- sessionTracker.addSession(request.sessionId, timeout);
- } else {
+ sessionTracker.commitSession(sessionId, cst.getTimeOut());
+ } else if (request == null || !request.isLocalSession()) {
--- End diff --
Do you need this check here?
Basically you removed the part of requesting localSession creation, because
it has already happened in PrepRequestProcessor and it's safe to leave the
default 'else' handler as it was.
---