incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1295133 - /incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
Date Wed, 29 Feb 2012 14:38:20 GMT
Author: ecn
Date: Wed Feb 29 14:38:20 2012
New Revision: 1295133

URL: http://svn.apache.org/viewvc?rev=1295133&view=rev
Log:
ACCUMULO-436 - continue merges that have started

Modified:
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/Master.java

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1295133&r1=1295132&r2=1295133&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
Wed Feb 29 14:38:20 2012
@@ -1508,7 +1508,7 @@ public class Master implements LiveTServ
         try {
           MergeState update = stats.nextMergeState();
           if (update == MergeState.MERGING) {
-            if (stats.verifyMergeConsistency(getConnector(), Master.this)) {
+            if (mergeStarted(stats.getMergeInfo()) || stats.verifyMergeConsistency(getConnector(),
Master.this)) {
               try {
                 if (stats.getMergeInfo().isDelete()) {
                   deleteTablets(stats.getMergeInfo());
@@ -1532,6 +1532,31 @@ public class Master implements LiveTServ
       }
     }
 
+    /**
+     * Determine if a merge has been started, and was interrupted and needs to be completed.
+     * 
+     * @param mergeInfo
+     * @return
+     * @throws AccumuloException
+     */
+    private boolean mergeStarted(MergeInfo mergeInfo) throws AccumuloException {
+      KeyExtent merge = mergeInfo.getRange();
+      KeyExtent highTablet = getHighTablet(merge);
+      // merge specifies -inf
+      if (merge.getPrevEndRow() == null) {
+        // lasttablet must start at -inf
+        return highTablet.getPrevEndRow() == null;
+      }
+      // upper end of merge is set -inf
+      if (highTablet.getPrevEndRow() == null) {
+        // nothing can come before this: merge is started
+        return true;
+      }
+      // if prevRow of last tablet is <= merge start, merge has started
+      Text mergeStart = merge.getPrevEndRow();
+      return highTablet.getPrevEndRow().compareTo(mergeStart.getBytes(), 0, mergeStart.getLength())
<= 0;
+    }
+
     private void deleteTablets(MergeInfo info) throws AccumuloException {
       KeyExtent range = info.getRange();
       log.debug("Deleting tablets for " + range);



Mime
View raw message