[
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15931547#comment-15931547
]
ASF GitHub Bot commented on ZOOKEEPER-2725:
-------------------------------------------
Github user hanm commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/195#discussion_r106797306
--- Diff:
src/java/main/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java ---
@@ -62,18 +64,40 @@ public Request checkUpgradeSession(Request request)
// This is called by the request processor thread (either follower
// or observer request processor), which is unique to a learner.
// So will not be called concurrently by two threads.
- if (request.type != OpCode.create ||
+ if ((request.type != OpCode.create && request.type !=
OpCode.create2 && request.type != OpCode.multi) ||
!upgradeableSessionTracker.isLocalSession(request.sessionId)) {
return null;
}
- CreateRequest createRequest = new CreateRequest();
- request.request.rewind();
- ByteBufferInputStream.byteBuffer2Record(request.request,
createRequest);
- request.request.rewind();
- CreateMode createMode =
CreateMode.fromFlag(createRequest.getFlags());
- if (!createMode.isEphemeral()) {
- return null;
+
+ if (OpCode.multi == request.type) {
+ MultiTransactionRecord multiTransactionRecord = new
MultiTransactionRecord();
+ request.request.rewind();
+ ByteBufferInputStream.byteBuffer2Record(request.request,
multiTransactionRecord);
+ request.request.rewind();
+ boolean containsEphemeralCreate = false;
+ for (Op op : multiTransactionRecord) {
+ if (op.getType() == OpCode.create || op.getType() ==
OpCode.create2) {
+ CreateRequest createRequest =
(CreateRequest)op.toRequestRecord();
+ CreateMode createMode =
CreateMode.fromFlag(createRequest.getFlags());
+ if (createMode.isEphemeral()) {
+ containsEphemeralCreate = true;
--- End diff --
I think we can just return null here (or break the loop) - there is no need
to check rest of ops because as long as there is an ephemeral / create we'd
upgrade session?
> Upgrading to a global session fails with a multiop
> --------------------------------------------------
>
> Key: ZOOKEEPER-2725
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2725
> Project: ZooKeeper
> Issue Type: Bug
> Components: server
> Affects Versions: 3.5.2
> Reporter: Brian Nixon
>
> On an ensemble with local sessions enabled, when a client with a local
> session requests the creation of an ephemeral node within a multi-op, the
> client gets a session expired message. The same multi-op works if the
> session is already global. This breaks the client's expectation of seamless
> promotion from local session to global session server-side.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)