accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [3/5] accumulo git commit: ACCUMULO-3315 Wait for the pool to terminate before continuing
Date Fri, 07 Nov 2014 18:31:09 GMT
ACCUMULO-3315 Wait for the pool to terminate before continuing


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

Branch: refs/heads/master
Commit: 4b87abd48e0a4d7a14dd181eb86850fb5865de3c
Parents: 62e3e9b
Author: Josh Elser <elserj@apache.org>
Authored: Fri Nov 7 13:15:15 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Nov 7 13:15:15 2014 -0500

----------------------------------------------------------------------
 .../accumulo/server/util/RandomizeVolumes.java   | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4b87abd4/server/base/src/main/java/org/apache/accumulo/server/util/RandomizeVolumes.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/RandomizeVolumes.java
b/server/base/src/main/java/org/apache/accumulo/server/util/RandomizeVolumes.java
index bb3bece..67d36a7 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/RandomizeVolumes.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/RandomizeVolumes.java
@@ -17,12 +17,11 @@
 package org.apache.accumulo.server.util;
 
 import static com.google.common.base.Charsets.UTF_8;
+import static org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN;
 
 import java.io.IOException;
 import java.util.Map.Entry;
-
-import org.apache.accumulo.server.security.SystemCredentials;
-import org.apache.accumulo.core.util.SimpleThreadPool;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.cli.ClientOnRequiredTable;
 import org.apache.accumulo.core.client.AccumuloException;
@@ -38,13 +37,14 @@ import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.SimpleThreadPool;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
+import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.accumulo.server.tables.TableManager;
 import org.apache.hadoop.fs.Path;
 import org.apache.log4j.Logger;
-import static org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN;
 
 public class RandomizeVolumes {
   private static final Logger log = Logger.getLogger(RandomizeVolumes.class);
@@ -108,7 +108,7 @@ public class RandomizeVolumes {
       }
       Key key = entry.getKey();
       Mutation m = new Mutation(key.getRow());
-      
+
       final String newLocation = vm.choose(ServerConstants.getBaseUris()) + Path.SEPARATOR
+ ServerConstants.TABLE_DIR + Path.SEPARATOR + tableId + Path.SEPARATOR + directory;
       m.put(key.getColumnFamily(), key.getColumnQualifier(), new Value(newLocation.getBytes(UTF_8)));
       if (log.isTraceEnabled()) {
@@ -129,6 +129,15 @@ public class RandomizeVolumes {
     }
     writer.close();
     pool.shutdown();
+    while (!pool.isTerminated()) {
+      log.trace("Waiting for mkdir() calls to finish");
+      try {
+        pool.awaitTermination(5, TimeUnit.SECONDS);
+      } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+        break;
+      }
+    }
     log.info("Updated " + count + " entries for table " + tableName);
     if (TableState.OFFLINE != tableState) {
       c.tableOperations().online(tableName, true);


Mime
View raw message