git commit: ACCUMULO-2422 reset watch on non-delete events
Repository: accumulo Updated Branches: refs/heads/1.5.1-SNAPSHOT 5dba407cc - 853ed5bb2 ACCUMULO-2422 reset watch on non-delete events Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/853ed5bb Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/853ed5bb Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/853ed5bb Branch: refs/heads/1.5.1-SNAPSHOT Commit: 853ed5bb2b2845284057af051a5d71835cfde8f5 Parents: 5dba407 Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:51:42 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:51:42 2014 -0500 -- .../main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java | 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/853ed5bb/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java -- diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java index 86c3b88..25f1020 100644 --- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java +++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java @@ -195,6 +195,12 @@ public class ZooLock implements Watcher { lw.failedToAcquireLock(new Exception(Zookeeper Session expired)); } } +} else { + try { +zooKeeper.getStatus(event.getPath(), this); + } catch (Exception ex) { +lw.failedToAcquireLock(ex); + } } }
[2/4] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a12bde88 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a12bde88 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a12bde88 Branch: refs/heads/1.6.0-SNAPSHOT Commit: a12bde8835ead60d7f0238b9c9769db663c6f344 Parents: b9bc5e2 853ed5b Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:51:51 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:51:51 2014 -0500 -- .../main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java | 6 ++ 1 file changed, 6 insertions(+) --
[3/4] git commit: ACCUMULO-2422 reset watch on non-delete events
ACCUMULO-2422 reset watch on non-delete events Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7d70ef58 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7d70ef58 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7d70ef58 Branch: refs/heads/1.6.0-SNAPSHOT Commit: 7d70ef5848cf6b42752ec708e0442d4b7aa98c2f Parents: a12bde8 Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:52:21 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:52:21 2014 -0500 -- .../test/functional/BackupMasterIT.java | 63 1 file changed, 63 insertions(+) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7d70ef58/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java new file mode 100644 index 000..8d530a7 --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java @@ -0,0 +1,63 @@ +/* + * 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.accumulo.test.functional; + +import java.util.Collections; +import java.util.List; + +import org.apache.accumulo.fate.util.UtilWaitThread; +import org.apache.accumulo.fate.zookeeper.ZooReaderWriter; +import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy; +import org.apache.accumulo.master.Master; +import org.junit.Test; + +public class BackupMasterIT extends ConfigurableMacIT { + + @Test(timeout= 10 * 1000) + public void test() throws Exception { +// wait for master +UtilWaitThread.sleep(1000); +// create a backup +Process backup = exec(Master.class); +try { + ZooReaderWriter writer = new ZooReaderWriter(cluster.getZooKeepers(), 30*1000, digest, accumulo:DONTTELL.getBytes()); + String root = /accumulo/ + getConnector().getInstance().getInstanceID(); + ListString children = Collections.emptyList(); + // wait for 2 lock entries + do { +UtilWaitThread.sleep(100); +children = writer.getChildren(root + /masters/lock); + } while (children.size() != 2); + Collections.sort(children); + // wait for the backup master to learn to be the backup + UtilWaitThread.sleep(1000); + // generate a false zookeeper event + String lockPath = root + /masters/lock/ + children.get(0); + byte data[] = writer.getData(lockPath, null); + writer.getZooKeeper().setData(lockPath, data, -1); + // let it propagate + UtilWaitThread.sleep(500); + // kill the master by removing its lock + writer.recursiveDelete(lockPath, NodeMissingPolicy.FAIL); + // ensure the backup becomes the master + getConnector().tableOperations().create(getTableNames(1)[0]); +} finally { + backup.destroy(); +} + } + +}
[1/4] git commit: ACCUMULO-2422 reset watch on non-delete events
Repository: accumulo Updated Branches: refs/heads/1.6.0-SNAPSHOT bd970de81 - 04d8cd8d4 ACCUMULO-2422 reset watch on non-delete events Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/853ed5bb Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/853ed5bb Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/853ed5bb Branch: refs/heads/1.6.0-SNAPSHOT Commit: 853ed5bb2b2845284057af051a5d71835cfde8f5 Parents: 5dba407 Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:51:42 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:51:42 2014 -0500 -- .../main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java | 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/853ed5bb/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java -- diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java index 86c3b88..25f1020 100644 --- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java +++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java @@ -195,6 +195,12 @@ public class ZooLock implements Watcher { lw.failedToAcquireLock(new Exception(Zookeeper Session expired)); } } +} else { + try { +zooKeeper.getStatus(event.getPath(), this); + } catch (Exception ex) { +lw.failedToAcquireLock(ex); + } } }
[4/4] git commit: Merge branch '1.6.0-SNAPSHOT' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6.0-SNAPSHOT
Merge branch '1.6.0-SNAPSHOT' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6.0-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/04d8cd8d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/04d8cd8d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/04d8cd8d Branch: refs/heads/1.6.0-SNAPSHOT Commit: 04d8cd8d4dbe6189a072a389344282513446dad7 Parents: 7d70ef5 bd970de Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:52:55 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:52:55 2014 -0500 -- .../apache/accumulo/core/client/impl/Tables.java | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) --
[1/4] git commit: ACCUMULO-2422 reset watch on non-delete events
Repository: accumulo Updated Branches: refs/heads/master 90b661991 - 07604ca05 ACCUMULO-2422 reset watch on non-delete events Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/853ed5bb Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/853ed5bb Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/853ed5bb Branch: refs/heads/master Commit: 853ed5bb2b2845284057af051a5d71835cfde8f5 Parents: 5dba407 Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:51:42 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:51:42 2014 -0500 -- .../main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java | 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/853ed5bb/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java -- diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java index 86c3b88..25f1020 100644 --- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java +++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java @@ -195,6 +195,12 @@ public class ZooLock implements Watcher { lw.failedToAcquireLock(new Exception(Zookeeper Session expired)); } } +} else { + try { +zooKeeper.getStatus(event.getPath(), this); + } catch (Exception ex) { +lw.failedToAcquireLock(ex); + } } }
[2/4] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a12bde88 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a12bde88 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a12bde88 Branch: refs/heads/master Commit: a12bde8835ead60d7f0238b9c9769db663c6f344 Parents: b9bc5e2 853ed5b Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:51:51 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:51:51 2014 -0500 -- .../main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java | 6 ++ 1 file changed, 6 insertions(+) --
[3/4] git commit: ACCUMULO-2422 reset watch on non-delete events
ACCUMULO-2422 reset watch on non-delete events Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7d70ef58 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7d70ef58 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7d70ef58 Branch: refs/heads/master Commit: 7d70ef5848cf6b42752ec708e0442d4b7aa98c2f Parents: a12bde8 Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:52:21 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:52:21 2014 -0500 -- .../test/functional/BackupMasterIT.java | 63 1 file changed, 63 insertions(+) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7d70ef58/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java new file mode 100644 index 000..8d530a7 --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/test/functional/BackupMasterIT.java @@ -0,0 +1,63 @@ +/* + * 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.accumulo.test.functional; + +import java.util.Collections; +import java.util.List; + +import org.apache.accumulo.fate.util.UtilWaitThread; +import org.apache.accumulo.fate.zookeeper.ZooReaderWriter; +import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy; +import org.apache.accumulo.master.Master; +import org.junit.Test; + +public class BackupMasterIT extends ConfigurableMacIT { + + @Test(timeout= 10 * 1000) + public void test() throws Exception { +// wait for master +UtilWaitThread.sleep(1000); +// create a backup +Process backup = exec(Master.class); +try { + ZooReaderWriter writer = new ZooReaderWriter(cluster.getZooKeepers(), 30*1000, digest, accumulo:DONTTELL.getBytes()); + String root = /accumulo/ + getConnector().getInstance().getInstanceID(); + ListString children = Collections.emptyList(); + // wait for 2 lock entries + do { +UtilWaitThread.sleep(100); +children = writer.getChildren(root + /masters/lock); + } while (children.size() != 2); + Collections.sort(children); + // wait for the backup master to learn to be the backup + UtilWaitThread.sleep(1000); + // generate a false zookeeper event + String lockPath = root + /masters/lock/ + children.get(0); + byte data[] = writer.getData(lockPath, null); + writer.getZooKeeper().setData(lockPath, data, -1); + // let it propagate + UtilWaitThread.sleep(500); + // kill the master by removing its lock + writer.recursiveDelete(lockPath, NodeMissingPolicy.FAIL); + // ensure the backup becomes the master + getConnector().tableOperations().create(getTableNames(1)[0]); +} finally { + backup.destroy(); +} + } + +}
[4/4] git commit: Merge branch '1.6.0-SNAPSHOT'
Merge branch '1.6.0-SNAPSHOT' Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/07604ca0 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/07604ca0 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/07604ca0 Branch: refs/heads/master Commit: 07604ca058c5927eb20468ab7c983f039243e145 Parents: 90b6619 7d70ef5 Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:52:30 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:52:30 2014 -0500 -- .../apache/accumulo/fate/zookeeper/ZooLock.java | 6 ++ .../test/functional/BackupMasterIT.java | 63 2 files changed, 69 insertions(+) --
[2/3] git commit: Merge branch '1.6.0-SNAPSHOT' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6.0-SNAPSHOT
Merge branch '1.6.0-SNAPSHOT' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6.0-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/04d8cd8d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/04d8cd8d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/04d8cd8d Branch: refs/heads/master Commit: 04d8cd8d4dbe6189a072a389344282513446dad7 Parents: 7d70ef5 bd970de Author: Eric Newton eric.new...@gmail.com Authored: Fri Feb 28 12:52:55 2014 -0500 Committer: Eric Newton eric.new...@gmail.com Committed: Fri Feb 28 12:52:55 2014 -0500 -- .../apache/accumulo/core/client/impl/Tables.java | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) --
[1/3] git commit: ACCUMULO-2421 Add table name to error message
Repository: accumulo Updated Branches: refs/heads/master 07604ca05 - 2b3202aee ACCUMULO-2421 Add table name to error message Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/bd970de8 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/bd970de8 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/bd970de8 Branch: refs/heads/master Commit: bd970de81567f4bcc363fe29bb109153d97a8947 Parents: b9bc5e2 Author: Christopher Tubbs ctubb...@apache.org Authored: Thu Feb 27 13:36:22 2014 -0500 Committer: Christopher Tubbs ctubb...@apache.org Committed: Thu Feb 27 13:48:52 2014 -0500 -- .../apache/accumulo/core/client/impl/Tables.java | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/bd970de8/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java -- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java index 404aa32..5988bda 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java @@ -275,7 +275,7 @@ public class Tables { public static PairString,String qualify(String tableName, String defaultNamespace) { if (!tableName.matches(Tables.VALID_NAME_REGEX)) - throw new IllegalArgumentException(Improper table name format); + throw new IllegalArgumentException(Invalid table name ' + tableName + '); if (MetadataTable.OLD_NAME.equals(tableName)) tableName = MetadataTable.NAME; if (tableName.contains(.)) { @@ -287,22 +287,26 @@ public class Tables { /** * Returns the namespace id for a given table ID. - * @param instance The Accumulo Instance - * @param tableId The tableId + * + * @param instance + * The Accumulo Instance + * @param tableId + * The tableId * @return The namespace id which this table resides in. - * @throws IllegalArgumentException if the table doesn't exist in ZooKeeper + * @throws IllegalArgumentException + * if the table doesn't exist in ZooKeeper */ public static String getNamespaceId(Instance instance, String tableId) throws IllegalArgumentException { ArgumentChecker.notNull(instance, tableId); - + ZooCache zc = getZooCache(instance); byte[] n = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + / + tableId + Constants.ZTABLE_NAMESPACE); - + // We might get null out of ZooCache if this tableID doesn't exist if (null == n) { throw new IllegalArgumentException(Table with id + tableId + does not exist); } - + return new String(n, Constants.UTF8); }
[3/3] git commit: Merge remote-tracking branch 'origin/1.6.0-SNAPSHOT' (for ACCUMULO-2421).
Merge remote-tracking branch 'origin/1.6.0-SNAPSHOT' (for ACCUMULO-2421). Conflicts: core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2b3202ae Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2b3202ae Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2b3202ae Branch: refs/heads/master Commit: 2b3202aee60a92c909d28d6376e73fc4cac1b370 Parents: 07604ca 04d8cd8 Author: Bill Havanki bhava...@cloudera.com Authored: Fri Feb 28 15:07:58 2014 -0500 Committer: Bill Havanki bhava...@cloudera.com Committed: Fri Feb 28 15:07:58 2014 -0500 -- .../apache/accumulo/core/client/impl/Tables.java | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/2b3202ae/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java -- diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java index 10ef48f,5988bda..1dd9ef0 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java @@@ -287,18 -287,21 +287,22 @@@ public class Tables /** * Returns the namespace id for a given table ID. -* @param instance The Accumulo Instance -* @param tableId The tableId +* +* @param instance +* The Accumulo Instance +* @param tableId +* The tableId * @return The namespace id which this table resides in. -* @throws IllegalArgumentException if the table doesn't exist in ZooKeeper +* @throws IllegalArgumentException +* if the table doesn't exist in ZooKeeper */ public static String getNamespaceId(Instance instance, String tableId) throws IllegalArgumentException { -ArgumentChecker.notNull(instance, tableId); +checkArgument(instance != null, instance is null); +checkArgument(tableId != null, tableId is null); - + ZooCache zc = getZooCache(instance); byte[] n = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + / + tableId + Constants.ZTABLE_NAMESPACE); - + // We might get null out of ZooCache if this tableID doesn't exist if (null == n) { throw new IllegalArgumentException(Table with id + tableId + does not exist);
[2/6] git commit: ACCUMULO-2422 Refine renewal of master lock watcher
ACCUMULO-2422 Refine renewal of master lock watcher The first commit for ACCUMULO-2422 succeeds in renewing the watch on another master's lock node when needed. This commit refines the solution: - The renewal was happening even after the master is able to acquire the lock. This led to a spurious log error message. This commit skips renewing the watch in that case. - If the renewal returns a null status, meaning the other master's lock node disappeared, the master now immediately tries again to acquire the lock. This matches watch establishment in other areas. A lot of logging at the trace level was added to ZooLock to assist future troubleshooting. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7eeff02c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7eeff02c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7eeff02c Branch: refs/heads/1.6.0-SNAPSHOT Commit: 7eeff02c7cf883765a33575a19d208be30e1e17c Parents: 853ed5b Author: Bill Havanki bhava...@cloudera.com Authored: Fri Feb 28 14:23:19 2014 -0500 Committer: Bill Havanki bhava...@cloudera.com Committed: Fri Feb 28 14:23:19 2014 -0500 -- .../apache/accumulo/fate/zookeeper/ZooLock.java | 43 +++- .../apache/accumulo/server/master/Master.java | 1 + 2 files changed, 34 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7eeff02c/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java -- diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java index 25f1020..03e159f 100644 --- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java +++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java @@ -144,8 +144,15 @@ public class ZooLock implements Watcher { } Collections.sort(children); +if (log.isTraceEnabled()) { + log.trace(Candidate lock nodes); + for (String child : children) { +log.trace(- + child); + } +} if (children.get(0).equals(myLock)) { + log.trace(First candidate is my lock, acquiring); if (!watchingParent) { throw new IllegalStateException(Can not acquire lock, no longer watching parent : + path); } @@ -166,13 +173,20 @@ public class ZooLock implements Watcher { } final String lockToWatch = path + / + prev; - -Stat stat = zooKeeper.getStatus(path + / + prev, new Watcher() { +log.trace(Establishing watch on + lockToWatch); +Stat stat = zooKeeper.getStatus(lockToWatch, new Watcher() { @Override public void process(WatchedEvent event) { - +if (log.isTraceEnabled()) { + log.trace(Processing event:); + log.trace(- type + event.getType()); + log.trace(- path + event.getPath()); + log.trace(- state + event.getState()); +} +boolean renew = true; if (event.getType() == EventType.NodeDeleted event.getPath().equals(lockToWatch)) { + log.trace(Detected deletion of + lockToWatch + , attempting to acquire lock); synchronized (ZooLock.this) { try { if (asyncLock != null) { @@ -187,19 +201,28 @@ public class ZooLock implements Watcher { } } } + renew = false; } -if (event.getState() == KeeperState.Expired) { +if (event.getState() == KeeperState.Expired || event.getState() == KeeperState.Disconnected) { synchronized (ZooLock.this) { if (lock == null) { - lw.failedToAcquireLock(new Exception(Zookeeper Session expired)); + lw.failedToAcquireLock(new Exception(Zookeeper Session expired / disconnected)); } } -} else { + renew = false; +} +if (renew) { + log.trace(Renewing watch on + lockToWatch); try { -zooKeeper.getStatus(event.getPath(), this); - } catch (Exception ex) { -lw.failedToAcquireLock(ex); +Stat restat = zooKeeper.getStatus(lockToWatch, this); +if (restat == null) { + lockAsync(myLock, lw); +} + } catch (KeeperException e) { +lw.failedToAcquireLock(new Exception(Failed to renew watch on other master node)); + } catch (InterruptedException e) { +lw.failedToAcquireLock(new Exception(Failed to renew watch on other master node)); } } } @@ -228,7 +251,7 @@ public class ZooLock implements Watcher { try { final String
[6/6] git commit: Merge branch '1.6.0-SNAPSHOT'
Merge branch '1.6.0-SNAPSHOT' Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/11d724e8 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/11d724e8 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/11d724e8 Branch: refs/heads/master Commit: 11d724e8793f963c76f247d0827995a435c4e11c Parents: 2b3202a 18a5500 Author: Bill Havanki bhava...@cloudera.com Authored: Fri Feb 28 15:09:06 2014 -0500 Committer: Bill Havanki bhava...@cloudera.com Committed: Fri Feb 28 15:09:06 2014 -0500 -- .../apache/accumulo/fate/zookeeper/ZooLock.java | 43 +++- .../java/org/apache/accumulo/master/Master.java | 1 + 2 files changed, 34 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/11d724e8/server/master/src/main/java/org/apache/accumulo/master/Master.java --
[5/6] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT Conflicts: server/src/main/java/org/apache/accumulo/server/master/Master.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/18a55009 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/18a55009 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/18a55009 Branch: refs/heads/1.6.0-SNAPSHOT Commit: 18a55009e2648c285b58f7aae0b0d2872cab1037 Parents: 04d8cd8 7eeff02 Author: Bill Havanki bhava...@cloudera.com Authored: Fri Feb 28 15:02:25 2014 -0500 Committer: Bill Havanki bhava...@cloudera.com Committed: Fri Feb 28 15:02:25 2014 -0500 -- .../apache/accumulo/fate/zookeeper/ZooLock.java | 43 +++- .../java/org/apache/accumulo/master/Master.java | 1 + 2 files changed, 34 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/18a55009/server/master/src/main/java/org/apache/accumulo/master/Master.java -- diff --cc server/master/src/main/java/org/apache/accumulo/master/Master.java index a063377,000..6a75872 mode 100644,00..100644 --- a/server/master/src/main/java/org/apache/accumulo/master/Master.java +++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java @@@ -1,1230 -1,0 +1,1231 @@@ +/* + * 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.accumulo.master; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.accumulo.core.Constants; +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Tables; +import org.apache.accumulo.core.client.impl.ThriftTransportPool; +import org.apache.accumulo.core.client.impl.thrift.TableOperation; +import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; +import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; +import org.apache.accumulo.core.conf.AccumuloConfiguration; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.master.state.tables.TableState; +import org.apache.accumulo.core.master.thrift.MasterClientService.Iface; +import org.apache.accumulo.core.master.thrift.MasterClientService.Processor; +import org.apache.accumulo.core.master.thrift.MasterGoalState; +import org.apache.accumulo.core.master.thrift.MasterState; +import org.apache.accumulo.core.master.thrift.TabletServerStatus; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.metadata.RootTable; +import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; +import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.security.Credentials; +import org.apache.accumulo.core.security.NamespacePermission; +import org.apache.accumulo.core.security.SecurityUtil; +import org.apache.accumulo.core.security.TablePermission; +import org.apache.accumulo.core.util.Daemon; +import org.apache.accumulo.core.util.Pair; +import org.apache.accumulo.core.util.UtilWaitThread; +import
[4/6] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT Conflicts: server/src/main/java/org/apache/accumulo/server/master/Master.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/18a55009 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/18a55009 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/18a55009 Branch: refs/heads/master Commit: 18a55009e2648c285b58f7aae0b0d2872cab1037 Parents: 04d8cd8 7eeff02 Author: Bill Havanki bhava...@cloudera.com Authored: Fri Feb 28 15:02:25 2014 -0500 Committer: Bill Havanki bhava...@cloudera.com Committed: Fri Feb 28 15:02:25 2014 -0500 -- .../apache/accumulo/fate/zookeeper/ZooLock.java | 43 +++- .../java/org/apache/accumulo/master/Master.java | 1 + 2 files changed, 34 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/18a55009/server/master/src/main/java/org/apache/accumulo/master/Master.java -- diff --cc server/master/src/main/java/org/apache/accumulo/master/Master.java index a063377,000..6a75872 mode 100644,00..100644 --- a/server/master/src/main/java/org/apache/accumulo/master/Master.java +++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java @@@ -1,1230 -1,0 +1,1231 @@@ +/* + * 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.accumulo.master; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.accumulo.core.Constants; +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Tables; +import org.apache.accumulo.core.client.impl.ThriftTransportPool; +import org.apache.accumulo.core.client.impl.thrift.TableOperation; +import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; +import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; +import org.apache.accumulo.core.conf.AccumuloConfiguration; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.master.state.tables.TableState; +import org.apache.accumulo.core.master.thrift.MasterClientService.Iface; +import org.apache.accumulo.core.master.thrift.MasterClientService.Processor; +import org.apache.accumulo.core.master.thrift.MasterGoalState; +import org.apache.accumulo.core.master.thrift.MasterState; +import org.apache.accumulo.core.master.thrift.TabletServerStatus; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.metadata.RootTable; +import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; +import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.security.Credentials; +import org.apache.accumulo.core.security.NamespacePermission; +import org.apache.accumulo.core.security.SecurityUtil; +import org.apache.accumulo.core.security.TablePermission; +import org.apache.accumulo.core.util.Daemon; +import org.apache.accumulo.core.util.Pair; +import org.apache.accumulo.core.util.UtilWaitThread; +import
[1/6] git commit: ACCUMULO-2422 Refine renewal of master lock watcher
Repository: accumulo Updated Branches: refs/heads/1.5.1-SNAPSHOT 853ed5bb2 - 7eeff02c7 refs/heads/1.6.0-SNAPSHOT 04d8cd8d4 - 18a55009e refs/heads/master 2b3202aee - 11d724e87 ACCUMULO-2422 Refine renewal of master lock watcher The first commit for ACCUMULO-2422 succeeds in renewing the watch on another master's lock node when needed. This commit refines the solution: - The renewal was happening even after the master is able to acquire the lock. This led to a spurious log error message. This commit skips renewing the watch in that case. - If the renewal returns a null status, meaning the other master's lock node disappeared, the master now immediately tries again to acquire the lock. This matches watch establishment in other areas. A lot of logging at the trace level was added to ZooLock to assist future troubleshooting. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7eeff02c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7eeff02c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7eeff02c Branch: refs/heads/1.5.1-SNAPSHOT Commit: 7eeff02c7cf883765a33575a19d208be30e1e17c Parents: 853ed5b Author: Bill Havanki bhava...@cloudera.com Authored: Fri Feb 28 14:23:19 2014 -0500 Committer: Bill Havanki bhava...@cloudera.com Committed: Fri Feb 28 14:23:19 2014 -0500 -- .../apache/accumulo/fate/zookeeper/ZooLock.java | 43 +++- .../apache/accumulo/server/master/Master.java | 1 + 2 files changed, 34 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7eeff02c/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java -- diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java index 25f1020..03e159f 100644 --- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java +++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java @@ -144,8 +144,15 @@ public class ZooLock implements Watcher { } Collections.sort(children); +if (log.isTraceEnabled()) { + log.trace(Candidate lock nodes); + for (String child : children) { +log.trace(- + child); + } +} if (children.get(0).equals(myLock)) { + log.trace(First candidate is my lock, acquiring); if (!watchingParent) { throw new IllegalStateException(Can not acquire lock, no longer watching parent : + path); } @@ -166,13 +173,20 @@ public class ZooLock implements Watcher { } final String lockToWatch = path + / + prev; - -Stat stat = zooKeeper.getStatus(path + / + prev, new Watcher() { +log.trace(Establishing watch on + lockToWatch); +Stat stat = zooKeeper.getStatus(lockToWatch, new Watcher() { @Override public void process(WatchedEvent event) { - +if (log.isTraceEnabled()) { + log.trace(Processing event:); + log.trace(- type + event.getType()); + log.trace(- path + event.getPath()); + log.trace(- state + event.getState()); +} +boolean renew = true; if (event.getType() == EventType.NodeDeleted event.getPath().equals(lockToWatch)) { + log.trace(Detected deletion of + lockToWatch + , attempting to acquire lock); synchronized (ZooLock.this) { try { if (asyncLock != null) { @@ -187,19 +201,28 @@ public class ZooLock implements Watcher { } } } + renew = false; } -if (event.getState() == KeeperState.Expired) { +if (event.getState() == KeeperState.Expired || event.getState() == KeeperState.Disconnected) { synchronized (ZooLock.this) { if (lock == null) { - lw.failedToAcquireLock(new Exception(Zookeeper Session expired)); + lw.failedToAcquireLock(new Exception(Zookeeper Session expired / disconnected)); } } -} else { + renew = false; +} +if (renew) { + log.trace(Renewing watch on + lockToWatch); try { -zooKeeper.getStatus(event.getPath(), this); - } catch (Exception ex) { -lw.failedToAcquireLock(ex); +Stat restat = zooKeeper.getStatus(lockToWatch, this); +if (restat == null) { + lockAsync(myLock, lw); +} + } catch (KeeperException e) { +lw.failedToAcquireLock(new Exception(Failed to renew watch on other master node)); + } catch (InterruptedException e) { +lw.failedToAcquireLock(new
[3/6] git commit: ACCUMULO-2422 Refine renewal of master lock watcher
ACCUMULO-2422 Refine renewal of master lock watcher The first commit for ACCUMULO-2422 succeeds in renewing the watch on another master's lock node when needed. This commit refines the solution: - The renewal was happening even after the master is able to acquire the lock. This led to a spurious log error message. This commit skips renewing the watch in that case. - If the renewal returns a null status, meaning the other master's lock node disappeared, the master now immediately tries again to acquire the lock. This matches watch establishment in other areas. A lot of logging at the trace level was added to ZooLock to assist future troubleshooting. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7eeff02c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7eeff02c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7eeff02c Branch: refs/heads/master Commit: 7eeff02c7cf883765a33575a19d208be30e1e17c Parents: 853ed5b Author: Bill Havanki bhava...@cloudera.com Authored: Fri Feb 28 14:23:19 2014 -0500 Committer: Bill Havanki bhava...@cloudera.com Committed: Fri Feb 28 14:23:19 2014 -0500 -- .../apache/accumulo/fate/zookeeper/ZooLock.java | 43 +++- .../apache/accumulo/server/master/Master.java | 1 + 2 files changed, 34 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7eeff02c/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java -- diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java index 25f1020..03e159f 100644 --- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java +++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java @@ -144,8 +144,15 @@ public class ZooLock implements Watcher { } Collections.sort(children); +if (log.isTraceEnabled()) { + log.trace(Candidate lock nodes); + for (String child : children) { +log.trace(- + child); + } +} if (children.get(0).equals(myLock)) { + log.trace(First candidate is my lock, acquiring); if (!watchingParent) { throw new IllegalStateException(Can not acquire lock, no longer watching parent : + path); } @@ -166,13 +173,20 @@ public class ZooLock implements Watcher { } final String lockToWatch = path + / + prev; - -Stat stat = zooKeeper.getStatus(path + / + prev, new Watcher() { +log.trace(Establishing watch on + lockToWatch); +Stat stat = zooKeeper.getStatus(lockToWatch, new Watcher() { @Override public void process(WatchedEvent event) { - +if (log.isTraceEnabled()) { + log.trace(Processing event:); + log.trace(- type + event.getType()); + log.trace(- path + event.getPath()); + log.trace(- state + event.getState()); +} +boolean renew = true; if (event.getType() == EventType.NodeDeleted event.getPath().equals(lockToWatch)) { + log.trace(Detected deletion of + lockToWatch + , attempting to acquire lock); synchronized (ZooLock.this) { try { if (asyncLock != null) { @@ -187,19 +201,28 @@ public class ZooLock implements Watcher { } } } + renew = false; } -if (event.getState() == KeeperState.Expired) { +if (event.getState() == KeeperState.Expired || event.getState() == KeeperState.Disconnected) { synchronized (ZooLock.this) { if (lock == null) { - lw.failedToAcquireLock(new Exception(Zookeeper Session expired)); + lw.failedToAcquireLock(new Exception(Zookeeper Session expired / disconnected)); } } -} else { + renew = false; +} +if (renew) { + log.trace(Renewing watch on + lockToWatch); try { -zooKeeper.getStatus(event.getPath(), this); - } catch (Exception ex) { -lw.failedToAcquireLock(ex); +Stat restat = zooKeeper.getStatus(lockToWatch, this); +if (restat == null) { + lockAsync(myLock, lw); +} + } catch (KeeperException e) { +lw.failedToAcquireLock(new Exception(Failed to renew watch on other master node)); + } catch (InterruptedException e) { +lw.failedToAcquireLock(new Exception(Failed to renew watch on other master node)); } } } @@ -228,7 +251,7 @@ public class ZooLock implements Watcher { try { final String asyncLockPath =