accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo] branch 1.9 updated: fixes #1031 fix concurrency bug and remove unused code (#1032)
Date Fri, 15 Mar 2019 15:06:47 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch 1.9
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/1.9 by this push:
     new deafe74  fixes #1031 fix concurrency bug and remove unused code (#1032)
deafe74 is described below

commit deafe74aec543fdfbf57038d365fb4d449b978ae
Author: Keith Turner <kturner@apache.org>
AuthorDate: Fri Mar 15 11:06:42 2019 -0400

    fixes #1031 fix concurrency bug and remove unused code (#1032)
---
 .../java/org/apache/accumulo/tserver/TabletServer.java | 18 +++---------------
 .../accumulo/tserver/tablet/CompactionRunner.java      |  7 -------
 .../org/apache/accumulo/tserver/tablet/Tablet.java     |  8 +++-----
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index c30b443..a260950 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -327,7 +327,6 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
   private HostAndPort clientAddress;
 
   private volatile boolean serverStopRequested = false;
-  private volatile boolean majorCompactorDisabled = false;
   private volatile boolean shutdownComplete = false;
 
   private ZooLock tabletServerLock;
@@ -1982,20 +1981,10 @@ public class TabletServer extends AccumuloServerContext implements
Runnable {
 
     @Override
     public void run() {
-      if (majorCompactorDisabled) {
-        // this will make split task that were queued when shutdown was
-        // initiated exit
-        return;
-      }
-
       splitTablet(tablet);
     }
   }
 
-  public boolean isMajorCompactionDisabled() {
-    return majorCompactorDisabled;
-  }
-
   public long updateTotalQueuedMutationSize(long additionalMutationSize) {
     return totalQueuedMutationSize.addAndGet(additionalMutationSize);
   }
@@ -2021,7 +2010,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
 
     @Override
     public void run() {
-      while (!majorCompactorDisabled) {
+      while (true) {
         try {
           sleepUninterruptibly(getConfiguration().getTimeInMillis(Property.TSERV_MAJC_DELAY),
               TimeUnit.MILLISECONDS);
@@ -2045,7 +2034,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
           Iterator<Entry<KeyExtent,Tablet>> iter = copyOnlineTablets.entrySet().iterator();
 
           // bail early now if we're shutting down
-          while (iter.hasNext() && !majorCompactorDisabled) {
+          while (iter.hasNext()) {
 
             Entry<KeyExtent,Tablet> entry = iter.next();
 
@@ -2077,8 +2066,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
             // idle compactions
             iter = copyOnlineTablets.entrySet().iterator();
 
-            while (iter.hasNext() && !majorCompactorDisabled
-                && numMajorCompactionsInProgress < idleCompactionsToStart) {
+            while (iter.hasNext() && numMajorCompactionsInProgress < idleCompactionsToStart)
{
               Entry<KeyExtent,Tablet> entry = iter.next();
               Tablet tablet = entry.getValue();
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
index 8de7a9e..f305d34 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
@@ -34,13 +34,6 @@ final class CompactionRunner implements Runnable, Comparable<CompactionRunner>
{
 
   @Override
   public void run() {
-    if (tablet.getTabletServer().isMajorCompactionDisabled()) {
-      // this will make compaction tasks that were queued when shutdown was
-      // initiated exit
-      tablet.removeMajorCompactionQueuedReason(reason);
-      return;
-    }
-
     CompactionStats stats = tablet.majorCompact(reason, queued);
 
     // Some compaction strategies may always return true for shouldCompact() because they
need to
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 2d177b3..6cf56f8 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
@@ -1808,10 +1808,6 @@ public class Tablet implements TabletCommitter {
 
   // BEGIN PRIVATE METHODS RELATED TO MAJOR COMPACTION
 
-  private boolean isCompactionEnabled() {
-    return !isClosing() && !getTabletServer().isMajorCompactionDisabled();
-  }
-
   private CompactionStats _majorCompact(MajorCompactionReason reason)
       throws IOException, CompactionCanceledException {
 
@@ -1996,7 +1992,9 @@ public class Tablet implements TabletCommitter {
           CompactionEnv cenv = new CompactionEnv() {
             @Override
             public boolean isCompactionEnabled() {
-              return Tablet.this.isCompactionEnabled();
+              // avoid calling isClosing() because its synchronized and this is called frequently
in
+              // compaction
+              return closeState != CloseState.CLOSING;
             }
 
             @Override


Mime
View raw message