Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/447#discussion_r161300774
--- 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 --
Local session creation is happened in ZooKeeperServer when the when
processing connection request, PrepRequestProcessor only deals with the global
sessions.
Local session creation will also send a createSession op into the processor
pipeline, so if we remove the else check, a lot of warning log will show for
local session createSession op, that's not what we wanted.
---