accumulo-commits mailing list archives

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


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

Branch: refs/heads/master
Commit: b90b123e1a4dee6a5654ee9dffb3a2bb447a14c6
Parents: abcc202
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Mon Jan 5 15:09:37 2015 -0500
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Jan 5 15:09:37 2015 -0500

----------------------------------------------------------------------
 .../apache/accumulo/tserver/tablet/Tablet.java  | 79 ++++++++++----------
 1 file changed, 38 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/b90b123e/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index c0c8b53..5690dce 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -2059,56 +2059,53 @@ public class Tablet implements TabletCommitter {
     boolean success = false;
     long start = System.currentTimeMillis();
 
+    timer.incrementStatusMajor();
+
+    synchronized (this) {
+      // check that compaction is still needed - defer to splitting
+      majorCompactionQueued.remove(reason);
+
+      if (isClosing() || isClosed() || !needsMajorCompaction(reason) || isMajorCompactionRunning()
|| needsSplit()) {
+        return null;
+      }
+
+      majorCompactionState = CompactionState.WAITING_TO_START;
+    }
+
     // Always trace majC
     Span span = Trace.on("majorCompaction");
 
     try {
-      timer.incrementStatusMajor();
-
+      majCStats = _majorCompact(reason);
+      if (reason == MajorCompactionReason.CHOP) {
+        MetadataTableUtil.chopped(getTabletServer(), getExtent(), this.getTabletServer().getLock());
+        getTabletServer().enqueueMasterMessage(new TabletStatusMessage(TabletLoadState.CHOPPED,
extent));
+      }
+      success = true;
+    } catch (CompactionCanceledException mcce) {
+      log.debug("Major compaction canceled, extent = " + getExtent());
+    } catch (Throwable t) {
+      log.error("MajC Failed, extent = " + getExtent());
+      log.error("MajC Failed, message = " + (t.getMessage() == null ? t.getClass().getName()
: t.getMessage()), 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 (isClosing() || isClosed() || !needsMajorCompaction(reason) || isMajorCompactionRunning()
|| needsSplit()) {
-          return null;
-        }
-
-        majorCompactionState = CompactionState.WAITING_TO_START;
+        majorCompactionState = null;
+        this.notifyAll();
       }
 
-      try {
-        majCStats = _majorCompact(reason);
-        if (reason == MajorCompactionReason.CHOP) {
-          MetadataTableUtil.chopped(getTabletServer(), getExtent(), this.getTabletServer().getLock());
-          getTabletServer().enqueueMasterMessage(new TabletStatusMessage(TabletLoadState.CHOPPED,
extent));
-        }
-        success = true;
-      } catch (CompactionCanceledException mcce) {
-        log.debug("Major compaction canceled, extent = " + getExtent());
-      } catch (Throwable t) {
-        log.error("MajC Failed, extent = " + getExtent());
-        log.error("MajC Failed, message = " + (t.getMessage() == null ? t.getClass().getName()
: t.getMessage()), t);
-      } finally {
-        // ensure we always reset boolean, even
-        // when an exception is thrown
-        synchronized (this) {
-          majorCompactionState = null;
-          this.notifyAll();
-        }
-
-        span.data("extent", "" + getExtent());
-        if (majCStats != null) {
-          span.data("read", "" + majCStats.getEntriesRead());
-          span.data("written", "" + majCStats.getEntriesWritten());
-        }
+      span.data("extent", "" + getExtent());
+      if (majCStats != null) {
+        span.data("read", "" + majCStats.getEntriesRead());
+        span.data("written", "" + majCStats.getEntriesWritten());
       }
-    } finally {
-      span.stop();
-      long count = 0;
-      if (majCStats != null)
-        count = majCStats.getEntriesRead();
-      timer.updateTime(Operation.MAJOR, queued, start, count, !success);
     }
+    span.stop();
+    long count = 0;
+    if (majCStats != null)
+      count = majCStats.getEntriesRead();
+    timer.updateTime(Operation.MAJOR, queued, start, count, !success);
 
     return majCStats;
   }


Mime
View raw message