accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [4/6] accumulo git commit: ACCUMULO-3462 reduce the opportunity for the queued tablet to get mis-marked, merge to 1.6
Date Mon, 05 Jan 2015 20:10:35 GMT
ACCUMULO-3462 reduce the opportunity for the queued tablet to get mis-marked, merge to 1.6


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

Branch: refs/heads/master
Commit: 4468089772b08b5619aafd4ac95ea448a0ba3bb7
Parents: 9c402ef
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Mon Jan 5 15:03:04 2015 -0500
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Jan 5 15:03:04 2015 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/tserver/Tablet.java     | 71 +++++++++-----------
 1 file changed, 33 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/44680897/server/tserver/src/main/java/org/apache/accumulo/tserver/Tablet.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/Tablet.java
index 9a07a4a..40c1b5e 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/Tablet.java
@@ -3320,56 +3320,51 @@ public class Tablet {
    */
 
   private CompactionStats majorCompact(MajorCompactionReason reason) {
-
     CompactionStats majCStats = null;
 
+    synchronized (this) {
+      // check that compaction is still needed - defer to splitting
+      majorCompactionQueued.remove(reason);
+
+      if (closing || closed || !needsMajorCompaction(reason) || majorCompactionInProgress
|| needsSplit()) {
+        return null;
+      }
+
+      majorCompactionInProgress = true;
+    }
+
     // Always trace majC
     Span span = Trace.on("majorCompaction");
 
     try {
+      majCStats = _majorCompact(reason);
+      if (reason == MajorCompactionReason.CHOP) {
+        MetadataTableUtil.chopped(getExtent(), this.tabletServer.getLock());
+        tabletServer.enqueueMasterMessage(new TabletStatusMessage(TabletLoadState.CHOPPED,
extent));
+      }
+    } catch (CompactionCanceledException mcce) {
+      log.debug("Major compaction canceled, extent = " + getExtent());
+      throw new RuntimeException(mcce);
+    } catch (Throwable t) {
+      log.error("MajC Failed, extent = " + getExtent());
+      log.error("MajC Failed, message = " + (t.getMessage() == null ? t.getClass().getName()
: t.getMessage()), t);
+      throw new RuntimeException(t);
+    } finally {
+      // ensure we always reset boolean, even
+      // when an exception is thrown
       synchronized (this) {
-        // check that compaction is still needed - defer to splitting
-        majorCompactionQueued.remove(reason);
-
-        if (closing || closed || !needsMajorCompaction(reason) || majorCompactionInProgress
|| needsSplit()) {
-          return null;
-        }
-
-        majorCompactionInProgress = true;
+        majorCompactionInProgress = false;
+        this.notifyAll();
       }
 
-      try {
-        majCStats = _majorCompact(reason);
-        if (reason == MajorCompactionReason.CHOP) {
-          MetadataTableUtil.chopped(getExtent(), this.tabletServer.getLock());
-          tabletServer.enqueueMasterMessage(new TabletStatusMessage(TabletLoadState.CHOPPED,
extent));
-        }
-      } catch (CompactionCanceledException mcce) {
-        log.debug("Major compaction canceled, extent = " + getExtent());
-        throw new RuntimeException(mcce);
-      } catch (Throwable t) {
-        log.error("MajC Failed, extent = " + getExtent());
-        log.error("MajC Failed, message = " + (t.getMessage() == null ? t.getClass().getName()
: t.getMessage()), t);
-        throw new RuntimeException(t);
-      } finally {
-        // ensure we always reset boolean, even
-        // when an exception is thrown
-        synchronized (this) {
-          majorCompactionInProgress = false;
-          this.notifyAll();
-        }
-
-        Span curr = Trace.currentTrace();
-        curr.data("extent", "" + getExtent());
-        if (majCStats != null) {
-          curr.data("read", "" + majCStats.getEntriesRead());
-          curr.data("written", "" + majCStats.getEntriesWritten());
-        }
+      Span curr = Trace.currentTrace();
+      curr.data("extent", "" + getExtent());
+      if (majCStats != null) {
+        curr.data("read", "" + majCStats.getEntriesRead());
+        curr.data("written", "" + majCStats.getEntriesWritten());
       }
-    } finally {
       span.stop();
     }
-
     return majCStats;
   }
 


Mime
View raw message