accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1237669 - in /incubator/accumulo/trunk: ./ src/core/ src/server/ src/server/src/main/java/org/apache/accumulo/server/master/Master.java src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
Date Mon, 30 Jan 2012 14:13:23 GMT
Author: ecn
Date: Mon Jan 30 14:13:22 2012
New Revision: 1237669

URL: http://svn.apache.org/viewvc?rev=1237669&view=rev
Log:
ACCUMULO-315 fix hang when table merge is unnecessary; added utility to print merge state
(merge to trunk)

Modified:
    incubator/accumulo/trunk/   (props changed)
    incubator/accumulo/trunk/src/core/   (props changed)
    incubator/accumulo/trunk/src/server/   (props changed)
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java

Propchange: incubator/accumulo/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 30 14:13:22 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195,1230180,1230736,1231043,1236873
 /incubator/accumulo/branches/1.3.5rc:1209938
-/incubator/accumulo/branches/1.4:1201902-1237630
+/incubator/accumulo/branches/1.4:1201902-1237667

Propchange: incubator/accumulo/trunk/src/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 30 14:13:22 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3/src/core:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215
 /incubator/accumulo/branches/1.3.5rc/src/core:1209938
-/incubator/accumulo/branches/1.4/src/core:1201902-1237630
+/incubator/accumulo/branches/1.4/src/core:1201902-1237667

Propchange: incubator/accumulo/trunk/src/server/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 30 14:13:22 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3/src/server:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611
 /incubator/accumulo/branches/1.3.5rc/src/server:1209938
-/incubator/accumulo/branches/1.4/src/server:1201902-1237630
+/incubator/accumulo/branches/1.4/src/server:1201902-1237667

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1237669&r1=1237668&r2=1237669&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
(original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
Mon Jan 30 14:13:22 2012
@@ -1494,13 +1494,14 @@ public class Master implements LiveTServ
                     deleteTablets(stats.getMergeInfo());
                   else
                     mergeMetadataRecords(stats.getMergeInfo());
-                  setMergeState(stats.getMergeInfo(), MergeState.COMPLETE);
-                  update = MergeState.NONE;
+                  setMergeState(stats.getMergeInfo(), update = MergeState.COMPLETE);
                 } catch (Exception ex) {
                   log.error("Unable merge metadata table records", ex);
                 }
               }
             }
+            if (update == MergeState.COMPLETE)
+              update = MergeState.NONE;
             setMergeState(stats.getMergeInfo(), update);
           }
         } catch (Exception ex) {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java?rev=1237669&r1=1237668&r2=1237669&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
(original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
Mon Jan 30 14:13:22 2012
@@ -17,18 +17,26 @@
 package org.apache.accumulo.server.master.state;
 
 import java.io.IOException;
+import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.security.SecurityConstants;
+import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
+import org.apache.zookeeper.data.Stat;
 
 public class MergeStats {
   final static private Logger log = Logger.getLogger(MergeStats.class);
@@ -172,4 +180,20 @@ public class MergeStats {
     }
     return chopped == verify.chopped && unassigned == verify.unassigned &&
unassigned == verify.total;
   }
+  
+  public static void main(String[] args) throws Exception {
+    Instance instance = HdfsZooInstance.getInstance();
+    Map<String,String> tableIdMap = instance.getConnector(SecurityConstants.getSystemCredentials()).tableOperations().tableIdMap();
+    for (String tableId : tableIdMap.keySet()) {
+      String path = ZooUtil.getRoot(instance.getInstanceID()) + Constants.ZTABLES + "/" +
tableId.toString() + "/merge";
+      MergeInfo info = new MergeInfo();
+      if (ZooReaderWriter.getInstance().exists(path)) {
+        byte[] data = ZooReaderWriter.getInstance().getData(path, new Stat());
+        DataInputBuffer in = new DataInputBuffer();
+        in.reset(data, data.length);
+        info.readFields(in);
+      }
+      System.out.println(String.format("%25s  %10s %10s %s", tableIdMap.get(tableId), info.state,
info.operation, info.range));
+    }
+  }
 }
\ No newline at end of file



Mime
View raw message