accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [04/12] accumulo git commit: ACCUMULO-3967 Compute the startRow correctly for failed extents.
Date Mon, 24 Aug 2015 03:59:30 GMT
ACCUMULO-3967 Compute the startRow correctly for failed extents.


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

Branch: refs/heads/master
Commit: 5cd2063dbd582bf2b3d2d7a6bd379a591b47b41f
Parents: dad7c7c
Author: Josh Elser <elserj@apache.org>
Authored: Sun Aug 23 17:16:20 2015 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Sun Aug 23 17:54:24 2015 -0400

----------------------------------------------------------------------
 .../accumulo/server/client/BulkImporter.java    | 14 ++++++++++---
 .../server/client/BulkImporterTest.java         | 21 ++++++++++++++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/5cd2063d/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java b/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
index e9c61cc..0f89e73 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
@@ -618,12 +618,20 @@ public class BulkImporter {
   public static List<TabletLocation> findOverlappingTablets(AccumuloConfiguration acuConf,
FileSystem fs, TabletLocator locator, Path file, KeyExtent failed,
       TCredentials credentials) throws Exception {
     locator.invalidateCache(failed);
-    Text start = failed.getPrevEndRow();
-    if (start != null)
-      start = Range.followingPrefix(start);
+    Text start = getStartRowForExtent(failed);
     return findOverlappingTablets(acuConf, fs, locator, file, start, failed.getEndRow(),
credentials);
   }
 
+  protected static Text getStartRowForExtent(KeyExtent extent) {
+    Text start = extent.getPrevEndRow();
+    if (start != null) {
+      start = new Text(start);
+      // ACCUMULO-3967 We want the first possible key in this tablet, not the following row
from the previous tablet
+      start.append(byte0, 0, 1);
+    }
+    return start;
+  }
+
   final static byte[] byte0 = {0};
 
   public static List<TabletLocation> findOverlappingTablets(AccumuloConfiguration acuConf,
FileSystem fs, TabletLocator locator, Path file, Text startRow,

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5cd2063d/server/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java
b/server/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java
index b6640e2..12219a0 100644
--- a/server/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java
+++ b/server/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java
@@ -149,4 +149,25 @@ public class BulkImporterTest {
     Assert.assertEquals(locator.invalidated, 1);
   }
 
+  @Test
+  public void testSequentialTablets() throws Exception {
+    // ACCUMULO-3967 make sure that the startRow we compute in BulkImporter is actually giving
+    // a correct startRow so that findOverlappingTablets works as intended.
+
+    // 1;2;1
+    KeyExtent extent = new KeyExtent(new Text("1"), new Text("2"), new Text("1"));
+    Assert.assertEquals(new Text("1\0"), BulkImporter.getStartRowForExtent(extent));
+
+    // 1;2<
+    extent = new KeyExtent(new Text("1"), new Text("2"), null);
+    Assert.assertEquals(null, BulkImporter.getStartRowForExtent(extent));
+
+    // 1<<
+    extent = new KeyExtent(new Text("1"), null, null);
+    Assert.assertEquals(null, BulkImporter.getStartRowForExtent(extent));
+
+    // 1;8;7777777
+    extent = new KeyExtent(new Text("1"), new Text("8"), new Text("7777777"));
+    Assert.assertEquals(new Text("7777777\0"), BulkImporter.getStartRowForExtent(extent));
+  }
 }


Mime
View raw message