accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-3933 fix breakage around root tablet Volume handling
Date Tue, 07 Jul 2015 18:26:12 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master b411fe319 -> 55a6d3e4d


ACCUMULO-3933 fix breakage around root tablet Volume handling


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

Branch: refs/heads/master
Commit: 07b06a3ae0225a2cc2825963448d1a75acc0d9dc
Parents: dd99cbf
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Tue Jul 7 14:21:16 2015 -0400
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Tue Jul 7 14:21:16 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/server/fs/VolumeUtil.java   | 21 ++++++++++++--------
 .../accumulo/tserver/tablet/TabletData.java     |  5 +++--
 .../java/org/apache/accumulo/test/VolumeIT.java |  2 +-
 3 files changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/07b06a3a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
index 7cd0d9e..427d2c9 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
@@ -164,14 +164,12 @@ public class VolumeUtil {
     }
   }
 
-  public static String switchRootTabletVolume(KeyExtent extent, String location) throws IOException
{
-    if (extent.isRootTablet()) {
-      String newLocation = switchVolume(location, FileType.TABLE, ServerConstants.getVolumeReplacements());
-      if (newLocation != null) {
-        MetadataTableUtil.setRootTabletDir(newLocation);
-        log.info("Volume replaced " + extent + " : " + location + " -> " + newLocation);
-        return new Path(newLocation).toString();
-      }
+  public static String switchRootTableVolume(String location) throws IOException {
+    String newLocation = switchVolume(location, FileType.TABLE, ServerConstants.getVolumeReplacements());
+    if (newLocation != null) {
+      MetadataTableUtil.setRootTabletDir(newLocation);
+      log.info("Volume replaced: " + location + " -> " + newLocation);
+      return new Path(newLocation).toString();
     }
     return location;
   }
@@ -244,6 +242,13 @@ public class VolumeUtil {
     }
 
     ret.dir = decommisionedTabletDir(context, zooLock, vm, extent, tabletDir);
+    if (extent.isRootTablet()) {
+      SortedMap<FileRef,DataFileValue> copy = ret.datafiles;
+      ret.datafiles = new TreeMap<>();
+      for (Entry<FileRef,DataFileValue> entry : copy.entrySet()) {
+        ret.datafiles.put(new FileRef(new Path(ret.dir, entry.getKey().path().getName()).toString()),
entry.getValue());
+      }
+    }
 
     // method this should return the exact strings that are in the metadata table
     return ret;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/07b06a3a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletData.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletData.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletData.java
index bfbf33f..d1cd5ce 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletData.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletData.java
@@ -133,7 +133,9 @@ public class TabletData {
 
   // Read basic root table metadata from zookeeper
   public TabletData(VolumeManager fs, ZooReader rdr, AccumuloConfiguration conf) throws IOException
{
-    Path location = new Path(MetadataTableUtil.getRootTabletDir());
+    directory = VolumeUtil.switchRootTableVolume(MetadataTableUtil.getRootTabletDir());
+
+    Path location = new Path(directory);
 
     // cleanReplacement() has special handling for deleting files
     FileStatus[] files = fs.listStatus(location);
@@ -168,7 +170,6 @@ public class TabletData {
     } catch (Exception ex) {
       throw new RuntimeException("Unable to read tablet log entries", ex);
     }
-    directory = VolumeUtil.switchRootTabletVolume(RootTable.EXTENT, MetadataTableUtil.getRootTabletDir());
   }
 
   // Data pulled from an existing tablet to make a split

http://git-wip-us.apache.org/repos/asf/accumulo/blob/07b06a3a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index c25370d..b325359 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -158,7 +158,7 @@ public class VolumeIT extends ConfigurableMacBase {
     List<DiskUsage> diskUsage = connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
     assertEquals(1, diskUsage.size());
     long usage = diskUsage.get(0).getUsage().longValue();
-    System.out.println("usage " + usage);
+    log.debug("usage {}", usage);
     assertTrue(usage > 700 && usage < 800);
   }
 


Mime
View raw message