incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/2] git commit: Fixing BLUR-7
Date Sun, 31 May 2015 17:56:54 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master f38b4b560 -> 933ce2889


Fixing BLUR-7


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/76e47470
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/76e47470
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/76e47470

Branch: refs/heads/master
Commit: 76e474700503999c7e8c189413026c4563d30e9a
Parents: 582eaa8
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun May 31 13:57:25 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun May 31 13:57:25 2015 -0400

----------------------------------------------------------------------
 .../blur/manager/writer/MutatableAction.java    |  3 +++
 .../apache/blur/manager/IndexManagerTest.java   | 28 ++++++++++++++++++++
 2 files changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/76e47470/blur-core/src/main/java/org/apache/blur/manager/writer/MutatableAction.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/MutatableAction.java b/blur-core/src/main/java/org/apache/blur/manager/writer/MutatableAction.java
index 00c1939..9f31ea8 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/MutatableAction.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/MutatableAction.java
@@ -696,6 +696,9 @@ public class MutatableAction extends IndexAction {
   public static List<RowMutation> reduceMutates(List<RowMutation> mutations)
throws BlurException {
     Map<String, RowMutation> mutateMap = new TreeMap<String, RowMutation>();
     for (RowMutation mutation : mutations) {
+      if (mutation.getRowId() == null) {
+        throw new BException("Mutation has null rowid [{0}]", mutation);
+      }
       RowMutation rowMutation = mutateMap.get(mutation.getRowId());
       if (rowMutation != null) {
         mutateMap.put(mutation.getRowId(), merge(rowMutation, mutation));

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/76e47470/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java b/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
index 5960e0e..250f8e4 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java
@@ -1224,6 +1224,34 @@ public class IndexManagerTest {
   }
 
   @Test
+  public void testMutationReplaceRowFailureWithNullRecordId() throws Exception {
+    RowMutation mutation = newRowMutation(
+        TABLE,
+        "row-4",
+        newRecordMutation(FAMILY, null, newColumn("testcol1", "value2"), newColumn("testcol2",
"value3"),
+            newColumn("testcol3", "value4")));
+    try {
+      indexManager.mutate(mutation);
+      fail();
+    } catch (BlurException e) {
+    }
+  }
+  
+  @Test
+  public void testMutationReplaceRowWithNullRowId() throws Exception {
+    RowMutation mutation = newRowMutation(
+        TABLE,
+        null,
+        newRecordMutation(FAMILY, "record-4", newColumn("testcol1", "value2"), newColumn("testcol2",
"value3"),
+            newColumn("testcol3", "value4")));
+    try {
+      indexManager.mutate(mutation);
+      fail();
+    } catch (BlurException e) {
+    }
+  }
+
+  @Test
   public void testMultipleMutationReplaceRecordWithInSameBatch() throws Exception {
     RowMutation mutation1 = newRowMutation(
         TABLE,


Mime
View raw message