[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-21 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15934943#comment-15934943
 ] 

Hudson commented on ZOOKEEPER-2725:
---

FAILURE: Integrated in Jenkins build ZooKeeper-trunk #3325 (See 
[https://builds.apache.org/job/ZooKeeper-trunk/3325/])
ZOOKEEPER-2725: Promote local session to global when ephemeral created (hanm: 
rev 63577ba52a829391ded3ae11c62c0e996865b5c7)
* (edit) 
src/java/main/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java
* (add) src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java


> 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
> Fix For: 3.6.0
>
>
> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-21 Thread Michael Han (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15934881#comment-15934881
 ] 

Michael Han commented on ZOOKEEPER-2725:


Merged to master, 
https://github.com/apache/zookeeper/commit/63577ba52a829391ded3ae11c62c0e996865b5c7,
 thanks [~nixon] for the patch!

> 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
> Fix For: 3.6.0
>
>
> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15934872#comment-15934872
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2725:
---

Github user asfgit closed the pull request at:

https://github.com/apache/zookeeper/pull/195


> 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
> Fix For: 3.6.0
>
>
> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-21 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15934805#comment-15934805
 ] 

Hadoop QA commented on ZOOKEEPER-2725:
--

+1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+1 tests included.  The patch appears to include 2 new or modified tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

+1 core tests.  The patch passed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/464//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/464//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/464//console

This message is automatically generated.

> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15934781#comment-15934781
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2725:
---

Github user enixon commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/195#discussion_r107191973
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.jute.BinaryOutputArchive;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.proto.CreateRequest;
+import org.apache.zookeeper.proto.GetDataRequest;
+import org.apache.zookeeper.server.quorum.QuorumPeer;
+import org.apache.zookeeper.server.quorum.QuorumZooKeeperServer;
+import org.apache.zookeeper.server.quorum.UpgradeableSessionTracker;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+
+String data = "test";
+String path = "/ephemeralcreatemultiop";
+zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
+
+QuorumZooKeeperServer server = 
getConnectedServer(zk.getSessionId());
+Assert.assertNotNull("unable to find server interlocutor", server);
+UpgradeableSessionTracker sessionTracker = 
(UpgradeableSessionTracker)server.getSessionTracker();
+Assert.assertFalse("session already global", 
sessionTracker.isGlobalSession(zk.getSessionId()));
+
+List multi = null;
+try {
+multi = zk.multi(Arrays.asList(
+Op.setData(path, data.getBytes(), 0),
+Op.create(path + "/e", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL),
+Op.create(path + "/p", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
+Op.create(path + "/q", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL)
+));
+} catch (KeeperException.SessionExpiredException e) {
+// the scenario that inspired this unit test
+Assert.fail("received session expired for a session promotion 
in a multi-op");
+}
+
+Assert.assertNotNull(multi);
+Assert.assertEquals(4, multi.size());
+Assert.assertEquals(data, new String(zk.getData(path + "/e", 
false, null)));
+Assert.assertEquals(data, new String(zk.getData(path + "/p", 
false, null)));
+Assert.assertEquals(data, new String(zk.getData(path + "/q", 
false, null)));
+Assert.assertTrue("session not promoted", 
sessionTracker.isGlobalSession(zk.getSessionId()));
+}
+
+@Test
+public void directCheckUpgradeSessionTest() throws IOException, 
InterruptedException, 

[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15933882#comment-15933882
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2725:
---

Github user hanm commented on the issue:

https://github.com/apache/zookeeper/pull/195
  
LGTM, except it does not build with JDK 7. Will merge after the fix.


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15933879#comment-15933879
 ] 

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_r107051228
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.jute.BinaryOutputArchive;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.proto.CreateRequest;
+import org.apache.zookeeper.proto.GetDataRequest;
+import org.apache.zookeeper.server.quorum.QuorumPeer;
+import org.apache.zookeeper.server.quorum.QuorumZooKeeperServer;
+import org.apache.zookeeper.server.quorum.UpgradeableSessionTracker;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+
+String data = "test";
+String path = "/ephemeralcreatemultiop";
+zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
+
+QuorumZooKeeperServer server = 
getConnectedServer(zk.getSessionId());
+Assert.assertNotNull("unable to find server interlocutor", server);
+UpgradeableSessionTracker sessionTracker = 
(UpgradeableSessionTracker)server.getSessionTracker();
+Assert.assertFalse("session already global", 
sessionTracker.isGlobalSession(zk.getSessionId()));
+
+List multi = null;
+try {
+multi = zk.multi(Arrays.asList(
+Op.setData(path, data.getBytes(), 0),
+Op.create(path + "/e", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL),
+Op.create(path + "/p", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
+Op.create(path + "/q", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL)
+));
+} catch (KeeperException.SessionExpiredException e) {
+// the scenario that inspired this unit test
+Assert.fail("received session expired for a session promotion 
in a multi-op");
+}
+
+Assert.assertNotNull(multi);
+Assert.assertEquals(4, multi.size());
+Assert.assertEquals(data, new String(zk.getData(path + "/e", 
false, null)));
+Assert.assertEquals(data, new String(zk.getData(path + "/p", 
false, null)));
+Assert.assertEquals(data, new String(zk.getData(path + "/q", 
false, null)));
+Assert.assertTrue("session not promoted", 
sessionTracker.isGlobalSession(zk.getSessionId()));
+}
+
+@Test
+public void directCheckUpgradeSessionTest() throws IOException, 
InterruptedException, 

[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15933878#comment-15933878
 ] 

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_r107051170
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.jute.BinaryOutputArchive;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.proto.CreateRequest;
+import org.apache.zookeeper.proto.GetDataRequest;
+import org.apache.zookeeper.server.quorum.QuorumPeer;
+import org.apache.zookeeper.server.quorum.QuorumZooKeeperServer;
+import org.apache.zookeeper.server.quorum.UpgradeableSessionTracker;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+
+String data = "test";
+String path = "/ephemeralcreatemultiop";
+zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
+
+QuorumZooKeeperServer server = 
getConnectedServer(zk.getSessionId());
+Assert.assertNotNull("unable to find server interlocutor", server);
+UpgradeableSessionTracker sessionTracker = 
(UpgradeableSessionTracker)server.getSessionTracker();
+Assert.assertFalse("session already global", 
sessionTracker.isGlobalSession(zk.getSessionId()));
+
+List multi = null;
+try {
+multi = zk.multi(Arrays.asList(
+Op.setData(path, data.getBytes(), 0),
+Op.create(path + "/e", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL),
+Op.create(path + "/p", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
+Op.create(path + "/q", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL)
+));
+} catch (KeeperException.SessionExpiredException e) {
+// the scenario that inspired this unit test
+Assert.fail("received session expired for a session promotion 
in a multi-op");
+}
+
+Assert.assertNotNull(multi);
+Assert.assertEquals(4, multi.size());
+Assert.assertEquals(data, new String(zk.getData(path + "/e", 
false, null)));
+Assert.assertEquals(data, new String(zk.getData(path + "/p", 
false, null)));
+Assert.assertEquals(data, new String(zk.getData(path + "/q", 
false, null)));
+Assert.assertTrue("session not promoted", 
sessionTracker.isGlobalSession(zk.getSessionId()));
+}
+
+@Test
+public void directCheckUpgradeSessionTest() throws IOException, 
InterruptedException, 

[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15933263#comment-15933263
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2725:
---

Github user enixon commented on the issue:

https://github.com/apache/zookeeper/pull/195
  
Proposed changes sound good, addressed with additional commit


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931551#comment-15931551
 ] 

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_r106797374
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.test.ClientBase;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+waitForClient(zk, ZooKeeper.States.CONNECTED);
+
+String data = "test";
+String path = "/ephemeralcreatemultiop";
+zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
+
+List multi = null;
+LOG.info("RUNNING MULTI-OP");
+try {
+multi = zk.multi(Arrays.asList(
+Op.setData(path, data.getBytes(), 0),
+Op.create(path + "/e", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL),
+Op.create(path + "/p", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
+Op.create(path + "/q", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL)
+));
+} catch (KeeperException.SessionExpiredException e) {
+LOG.info("SESSION EXPIRED", e);
+}
+LOG.info("TESTING RESULTS");
+Assert.assertNotNull(multi);
--- End diff --

In addition to these tests, it might be helpful to verify that a session 
upgrade has actually happened. I think we can verify that by comparing the old 
session id retrieved from zk before the multi-op and the new session id?


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931549#comment-15931549
 ] 

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_r106797356
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.test.ClientBase;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+waitForClient(zk, ZooKeeper.States.CONNECTED);
+
+String data = "test";
+String path = "/ephemeralcreatemultiop";
+zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
+
+List multi = null;
+LOG.info("RUNNING MULTI-OP");
+try {
+multi = zk.multi(Arrays.asList(
+Op.setData(path, data.getBytes(), 0),
+Op.create(path + "/e", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL),
+Op.create(path + "/p", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
+Op.create(path + "/q", data.getBytes(), 
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL)
+));
+} catch (KeeperException.SessionExpiredException e) {
+LOG.info("SESSION EXPIRED", e);
--- End diff --

We are not expected to get a SessionExpiredException here right with this 
patch, right? So might worth to put an assert here.


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931548#comment-15931548
 ] 

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_r106797340
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.test.ClientBase;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+waitForClient(zk, ZooKeeper.States.CONNECTED);
--- End diff --

Right, there is no need for this check (which use polling which is not 
recommended.). createClient already ensures that zk is in connected state via 
watchers. The only benefit of additional check here might be that in case of 
flaky test environment, a zk might loss connection to server right after 
createClient, but in that case we might want to wrap the subsequent test code 
(i.e. create) using retry with timeout logic.


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-17 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15930915#comment-15930915
 ] 

Hadoop QA commented on ZOOKEEPER-2725:
--

+1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+1 tests included.  The patch appears to include 2 new or modified tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

+1 core tests.  The patch passed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/448//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/448//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/448//console

This message is automatically generated.

> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15930852#comment-15930852
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2725:
---

Github user afine commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/195#discussion_r106757640
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.test.ClientBase;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+waitForClient(zk, ZooKeeper.States.CONNECTED);
--- End diff --

Not sure we need this. I don't think we need to do this in other tests.


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15930853#comment-15930853
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2725:
---

Github user afine commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/195#discussion_r106759077
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.test.ClientBase;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
--- End diff --

Would it be possible to test `public Request checkUpgradeSession(Request 
request)` directly in addition to this integration style test?


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15930851#comment-15930851
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2725:
---

Github user afine commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/195#discussion_r106757751
  
--- Diff: 
src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Op;
+import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.test.ClientBase;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultiOpSessionUpgradeTest extends QuorumBase {
+protected static final Logger LOG = 
LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
+
+@Override
+public void setUp() throws Exception {
+localSessionsEnabled = true;
+localSessionsUpgradingEnabled = true;
+super.setUp();
+}
+
+@Test
+public void ephemeralCreateMultiOpTest() throws KeeperException, 
InterruptedException, IOException {
+final ZooKeeper zk = createClient();
+waitForClient(zk, ZooKeeper.States.CONNECTED);
+
+String data = "test";
+String path = "/ephemeralcreatemultiop";
+zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
+
+List multi = null;
+LOG.info("RUNNING MULTI-OP");
--- End diff --

nit: not sure we need all of this logging


> 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)


[jira] [Commented] (ZOOKEEPER-2725) Upgrading to a global session fails with a multiop

2017-03-15 Thread Brian Nixon (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15927211#comment-15927211
 ] 

Brian Nixon commented on ZOOKEEPER-2725:


I messed up the name of the pull request - meant to link 
https://github.com/apache/zookeeper/pull/195 to this issue.

> 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)