accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo] branch master updated: Fix summarizer bug with empty loc group (#707)
Date Wed, 17 Oct 2018 19:31:36 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new ed29ca3  Fix summarizer bug with empty loc group (#707)
ed29ca3 is described below

commit ed29ca3be4953ec29a7165aa2f4b602b668c6698
Author: Keith Turner <kturner@apache.org>
AuthorDate: Wed Oct 17 15:31:31 2018 -0400

    Fix summarizer bug with empty loc group (#707)
    
    For a table with multiple locality groups and a locality group with no data,
    feching summaries would fail.  Found this while working on apache/fluo#1054
---
 .../java/org/apache/accumulo/core/summary/SummarySerializer.java    | 4 ++++
 .../main/java/org/apache/accumulo/test/functional/SummaryIT.java    | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/summary/SummarySerializer.java b/core/src/main/java/org/apache/accumulo/core/summary/SummarySerializer.java
index d84f910..e3a6f61 100644
--- a/core/src/main/java/org/apache/accumulo/core/summary/SummarySerializer.java
+++ b/core/src/main/java/org/apache/accumulo/core/summary/SummarySerializer.java
@@ -433,6 +433,10 @@ class SummarySerializer {
 
     boolean exceedsRange(Text startRow, Text endRow) {
 
+      if (summaries.length == 0) {
+        return false;
+      }
+
       Text lastRow = summaries[summaries.length - 1].lastRow;
       if (startRow != null && firstRow.compareTo(startRow) <= 0
           && startRow.compareTo(lastRow) < 0) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
index 78baa7f..749d1d7 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java
@@ -717,13 +717,15 @@ public class SummaryIT extends AccumuloClusterHarness {
     SummarizerConfiguration sc1 = SummarizerConfiguration.builder(FamilySummarizer.class).build();
     SummarizerConfiguration sc2 = SummarizerConfiguration.builder(BasicSummarizer.class).build();
     ntc.enableSummarization(sc1, sc2);
-    c.tableOperations().create(table, ntc);
 
     Map<String,Set<Text>> lgroups = new HashMap<>();
     lgroups.put("lg1", ImmutableSet.of(new Text("chocolate"), new Text("coffee")));
     lgroups.put("lg2", ImmutableSet.of(new Text(" broccoli "), new Text("cabbage")));
+    // create a locality group that will not have data in it
+    lgroups.put("lg3", ImmutableSet.of(new Text(" apple "), new Text("orange")));
 
-    c.tableOperations().setLocalityGroups(table, lgroups);
+    ntc.setLocalityGroups(lgroups);
+    c.tableOperations().create(table, ntc);
 
     Map<Key,Value> expected = new HashMap<>();
     try (BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig())) {


Mime
View raw message