You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/10/10 21:39:19 UTC

[1/3] git commit: ACCUMULO-3218 Set the list separator to \0 to 'disable' list interpretation

Repository: accumulo
Updated Branches:
  refs/heads/1.6 a234def61 -> 1b35d2633
  refs/heads/master 4bbaddcab -> 5640280d8


ACCUMULO-3218 Set the list separator to \0 to 'disable' list interpretation

ZooKeeperInstance, because of how commons-configuration was parsing the
values, was treating a comma separated list of ZK servers (which
we intend to be a single value) as multiple and only returning
the first when getString was called on its key. We have no case
where we actually want values to be automatically parsed into an
array, so we can set it to a separator highly unlikely to be used.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1b35d263
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1b35d263
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1b35d263

Branch: refs/heads/1.6
Commit: 1b35d2633e7558b49a1ff8887a3bc37c19d0b34f
Parents: a234def
Author: Josh Elser <el...@apache.org>
Authored: Thu Oct 9 20:59:03 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Oct 10 14:54:20 2014 -0400

----------------------------------------------------------------------
 .../core/client/ClientConfiguration.java        |  2 ++
 .../core/client/ZooKeeperInstanceTest.java      | 22 ++++++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b35d263/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
index b64fab4..17ad10b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
@@ -107,6 +107,8 @@ public class ClientConfiguration extends CompositeConfiguration {
 
   public ClientConfiguration(List<? extends Configuration> configs) {
     super(configs);
+    // Don't do list interpolation
+    this.setListDelimiter('\0');
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b35d263/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java b/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
index 8d86d5a..dde5575 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
@@ -16,18 +16,20 @@
  */
 package org.apache.accumulo.core.client;
 
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
+
 import java.util.List;
 import java.util.UUID;
+
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
 
 public class ZooKeeperInstanceTest {
   private static final UUID IID = UUID.randomUUID();
@@ -140,4 +142,16 @@ public class ZooKeeperInstanceTest {
     replay(zc);
     assertEquals("child2", zki.getInstanceName());
   }
+
+  @Test
+  public void testAllZooKeepersAreUsed() {
+    final String zookeepers = "zk1,zk2,zk3", instanceName = "accumulo";
+    ZooCacheFactory factory = createMock(ZooCacheFactory.class);
+    expect(factory.getZooCache(zookeepers, 30000)).andReturn(zc).anyTimes();
+    replay(factory);
+    ClientConfiguration cfg = ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zookeepers);
+    ZooKeeperInstance zki = new ZooKeeperInstance(cfg, factory);
+    assertEquals(zookeepers, zki.getZooKeepers());
+    assertEquals(instanceName, zki.getInstanceName());
+  }
 }


[3/3] git commit: Merge branch '1.6'

Posted by el...@apache.org.
Merge branch '1.6'

Conflicts:
	core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/5640280d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/5640280d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/5640280d

Branch: refs/heads/master
Commit: 5640280d83015a14ea7eacfb9a21d3a8fddf7a08
Parents: 4bbaddc 1b35d26
Author: Josh Elser <el...@apache.org>
Authored: Fri Oct 10 15:39:08 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Oct 10 15:39:08 2014 -0400

----------------------------------------------------------------------
 .../core/client/ClientConfiguration.java        |  2 ++
 .../core/client/ZooKeeperInstanceTest.java      | 22 ++++++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/5640280d/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5640280d/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
----------------------------------------------------------------------
diff --cc core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
index b215f4c,dde5575..98de0b5
--- a/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
@@@ -16,9 -16,14 +16,15 @@@
   */
  package org.apache.accumulo.core.client;
  
+ import static org.easymock.EasyMock.createMock;
+ import static org.easymock.EasyMock.expect;
+ import static org.easymock.EasyMock.replay;
+ import static org.junit.Assert.assertEquals;
+ 
 +import java.nio.charset.StandardCharsets;
  import java.util.List;
  import java.util.UUID;
+ 
  import org.apache.accumulo.core.Constants;
  import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
  import org.apache.accumulo.fate.zookeeper.ZooCache;


[2/3] git commit: ACCUMULO-3218 Set the list separator to \0 to 'disable' list interpretation

Posted by el...@apache.org.
ACCUMULO-3218 Set the list separator to \0 to 'disable' list interpretation

ZooKeeperInstance, because of how commons-configuration was parsing the
values, was treating a comma separated list of ZK servers (which
we intend to be a single value) as multiple and only returning
the first when getString was called on its key. We have no case
where we actually want values to be automatically parsed into an
array, so we can set it to a separator highly unlikely to be used.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1b35d263
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1b35d263
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1b35d263

Branch: refs/heads/master
Commit: 1b35d2633e7558b49a1ff8887a3bc37c19d0b34f
Parents: a234def
Author: Josh Elser <el...@apache.org>
Authored: Thu Oct 9 20:59:03 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Oct 10 14:54:20 2014 -0400

----------------------------------------------------------------------
 .../core/client/ClientConfiguration.java        |  2 ++
 .../core/client/ZooKeeperInstanceTest.java      | 22 ++++++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b35d263/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
index b64fab4..17ad10b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
@@ -107,6 +107,8 @@ public class ClientConfiguration extends CompositeConfiguration {
 
   public ClientConfiguration(List<? extends Configuration> configs) {
     super(configs);
+    // Don't do list interpolation
+    this.setListDelimiter('\0');
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b35d263/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java b/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
index 8d86d5a..dde5575 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
@@ -16,18 +16,20 @@
  */
 package org.apache.accumulo.core.client;
 
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
+
 import java.util.List;
 import java.util.UUID;
+
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
 
 public class ZooKeeperInstanceTest {
   private static final UUID IID = UUID.randomUUID();
@@ -140,4 +142,16 @@ public class ZooKeeperInstanceTest {
     replay(zc);
     assertEquals("child2", zki.getInstanceName());
   }
+
+  @Test
+  public void testAllZooKeepersAreUsed() {
+    final String zookeepers = "zk1,zk2,zk3", instanceName = "accumulo";
+    ZooCacheFactory factory = createMock(ZooCacheFactory.class);
+    expect(factory.getZooCache(zookeepers, 30000)).andReturn(zc).anyTimes();
+    replay(factory);
+    ClientConfiguration cfg = ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zookeepers);
+    ZooKeeperInstance zki = new ZooKeeperInstance(cfg, factory);
+    assertEquals(zookeepers, zki.getZooKeepers());
+    assertEquals(instanceName, zki.getInstanceName());
+  }
 }