accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [02/26] git commit: ACCUMULO-2451 Update thet data version on all volumes instead of just one
Date Fri, 14 Mar 2014 21:11:28 GMT
ACCUMULO-2451 Update thet data version on all volumes instead of just one


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

Branch: refs/heads/ACCUMULO-2061
Commit: 7086a7e70c0c551ce41f9f55addaf3a1a22b1d06
Parents: db76dd7
Author: Josh Elser <elserj@apache.org>
Authored: Wed Mar 12 12:10:44 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Wed Mar 12 12:10:44 2014 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/server/Accumulo.java    | 22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7086a7e7/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
index 48534f0..f7f2298 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
@@ -51,15 +51,21 @@ public class Accumulo {
   private static final Logger log = Logger.getLogger(Accumulo.class);
   
   public static synchronized void updateAccumuloVersion(VolumeManager fs) {
-    // TODO ACCUMULO-2451 Should update all volumes, not one 
-    Volume volume = fs.getVolumes().iterator().next();
-    try {
-      if (getAccumuloPersistentVersion(fs) == ServerConstants.PREV_DATA_VERSION) {
-        fs.create(new Path(ServerConstants.getDataVersionLocation(volume), Integer.toString(ServerConstants.DATA_VERSION)));
-        fs.delete(new Path(ServerConstants.getDataVersionLocation(volume), Integer.toString(ServerConstants.PREV_DATA_VERSION)));
+    for (Volume volume : fs.getVolumes()) {
+      try {
+        if (getAccumuloPersistentVersion(fs) == ServerConstants.PREV_DATA_VERSION) {
+          log.debug("Attempting to upgrade " + volume);
+          Path dataVersionLocation = ServerConstants.getDataVersionLocation(volume);
+          fs.create(new Path(dataVersionLocation, Integer.toString(ServerConstants.DATA_VERSION))).close();
+
+          Path prevDataVersionLoc = new Path(dataVersionLocation, Integer.toString(ServerConstants.PREV_DATA_VERSION));
+          if (!fs.delete(prevDataVersionLoc)) {
+            throw new RuntimeException("Could not delete previous data version location ("
+ prevDataVersionLoc + ") for " + volume);
+          }
+        }
+      } catch (IOException e) {
+        throw new RuntimeException("Unable to set accumulo version: an error occurred.",
e);
       }
-    } catch (IOException e) {
-      throw new RuntimeException("Unable to set accumulo version: an error occurred.", e);
     }
   }
   


Mime
View raw message