accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/7] accumulo git commit: ACCUMULO-4180 Fix bugs Josh found in InMemoryMapIT
Date Thu, 07 Apr 2016 16:35:01 GMT
ACCUMULO-4180 Fix bugs Josh found in InMemoryMapIT

Exposed a bug in InMemoryMap setting the map type, which is fixed as well.

Signed-off-by: Josh Elser <elserj@apache.org>


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

Branch: refs/heads/1.7
Commit: b8084af36c51ff3831d536c3c8238bef3222363f
Parents: 0712471
Author: Michael Wall <mjwall@gmail.com>
Authored: Thu Apr 7 10:34:51 2016 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Apr 7 11:57:06 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/tserver/InMemoryMap.java     |  2 +-
 .../test/java/org/apache/accumulo/test/InMemoryMapIT.java | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/b8084af3/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
index 614b34a..792d35a 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
@@ -213,7 +213,7 @@ public class InMemoryMap {
       mapType = useNativeMap ? TYPE_NATIVE_MAP_WRAPPER : TYPE_DEFAULT_MAP;
     } else {
       map = new LocalityGroupMap(lggroups, useNativeMap);
-      mapType = useNativeMap ? TYPE_LOCALITY_GROUP_MAP : TYPE_LOCALITY_GROUP_MAP_NATIVE;
+      mapType = useNativeMap ? TYPE_LOCALITY_GROUP_MAP_NATIVE : TYPE_LOCALITY_GROUP_MAP;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/b8084af3/test/src/test/java/org/apache/accumulo/test/InMemoryMapIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/InMemoryMapIT.java b/test/src/test/java/org/apache/accumulo/test/InMemoryMapIT.java
index 102762a..6eec2e8 100644
--- a/test/src/test/java/org/apache/accumulo/test/InMemoryMapIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/InMemoryMapIT.java
@@ -204,12 +204,18 @@ public class InMemoryMapIT {
       defaultMap = new InMemoryMap(false, tempFolder.newFolder().getAbsolutePath());
       nativeMapWrapper = new InMemoryMap(true, tempFolder.newFolder().getAbsolutePath());
       localityGroupMap = new InMemoryMap(getLocalityGroups(), false, tempFolder.newFolder().getAbsolutePath());
-      localityGroupMapWithNative = new InMemoryMap(getLocalityGroups(), false, tempFolder.newFolder().getAbsolutePath());
+      localityGroupMapWithNative = new InMemoryMap(getLocalityGroups(), true, tempFolder.newFolder().getAbsolutePath());
     } catch (IOException e) {
       log.error("Error getting new InMemoryMap ", e);
       fail(e.getMessage());
     }
 
+    // ensure the maps are correct type
+    assertEquals("Not a DefaultMap", InMemoryMap.TYPE_DEFAULT_MAP, defaultMap.getMapType());
+    assertEquals("Not a NativeMapWrapper", InMemoryMap.TYPE_NATIVE_MAP_WRAPPER, nativeMapWrapper.getMapType());
+    assertEquals("Not a LocalityGroupMap", InMemoryMap.TYPE_LOCALITY_GROUP_MAP, localityGroupMap.getMapType());
+    assertEquals("Not a LocalityGroupMap with native", InMemoryMap.TYPE_LOCALITY_GROUP_MAP_NATIVE,
localityGroupMapWithNative.getMapType());
+
     defaultMap.mutate(mutations);
     nativeMapWrapper.mutate(mutations);
     localityGroupMap.mutate(mutations);
@@ -303,7 +309,7 @@ public class InMemoryMapIT {
   private Map<String,Set<ByteSequence>> getLocalityGroups() {
     Map<String,Set<ByteSequence>> locgro = new HashMap<String,Set<ByteSequence>>();
     locgro.put("a", newCFSet("cf", "cf2"));
-    locgro.put("a", newCFSet("cf3", "cf4"));
+    locgro.put("b", newCFSet("cf3", "cf4"));
     return locgro;
   }
 


Mime
View raw message