You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2019/03/07 21:31:51 UTC

[accumulo] branch master updated: improve find split suppsression code (#1016)

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 1e4ce7f  improve find split suppsression code (#1016)
1e4ce7f is described below

commit 1e4ce7f33e3a1a9c06d51121f8bb550813529c33
Author: Keith Turner <kt...@apache.org>
AuthorDate: Thu Mar 7 16:31:47 2019 -0500

    improve find split suppsression code (#1016)
---
 .../org/apache/accumulo/tserver/tablet/Tablet.java | 71 ++++++++++++----------
 1 file changed, 38 insertions(+), 33 deletions(-)

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 270f7c3..2bf3de9 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
@@ -1576,9 +1576,6 @@ public class Tablet {
     return size;
   }
 
-  private boolean sawBigRow = false;
-  private long timeOfLastMinCWhenBigFreakinRowWasSeen = 0;
-  private long timeOfLastImportWhenBigFreakinRowWasSeen = 0;
   private final long splitCreationTime;
 
   private SplitRowSpec findSplitRow(Collection<FileRef> files) {
@@ -1590,23 +1587,11 @@ public class Tablet {
     long splitThreshold = tableConfiguration.getAsBytes(Property.TABLE_SPLIT_THRESHOLD);
     long maxEndRow = tableConfiguration.getAsBytes(Property.TABLE_MAX_END_ROW_SIZE);
 
-    if (extent.isRootTablet() || estimateTabletSize() <= splitThreshold) {
+    if (extent.isRootTablet() || isFindSplitsSuppressed()
+        || estimateTabletSize() <= splitThreshold) {
       return null;
     }
 
-    // have seen a big row before, do not bother checking unless a minor compaction or map file
-    // import has occurred.
-    if (sawBigRow) {
-      if (timeOfLastMinCWhenBigFreakinRowWasSeen != lastMinorCompactionFinishTime
-          || timeOfLastImportWhenBigFreakinRowWasSeen != lastMapFileImportTime) {
-        // a minor compaction or map file import has occurred... check again
-        sawBigRow = false;
-      } else {
-        // nothing changed, do not split
-        return null;
-      }
-    }
-
     SortedMap<Double,Key> keys = null;
 
     try {
@@ -1620,12 +1605,7 @@ public class Tablet {
 
     if (keys.isEmpty()) {
       log.info("Cannot split tablet " + extent + ", files contain no data for tablet.");
-
-      // set the following to keep tablet from attempting to split until the tablets set of files
-      // changes.
-      sawBigRow = true;
-      timeOfLastMinCWhenBigFreakinRowWasSeen = lastMinorCompactionFinishTime;
-      timeOfLastImportWhenBigFreakinRowWasSeen = lastMapFileImportTime;
+      suppressFindSplits();
       return null;
     }
 
@@ -1654,9 +1634,7 @@ public class Tablet {
             log.warn("Cannot split tablet {}, selected split point too long.  Length :  {}", extent,
                 candidate.getLength());
 
-            sawBigRow = true;
-            timeOfLastMinCWhenBigFreakinRowWasSeen = lastMinorCompactionFinishTime;
-            timeOfLastImportWhenBigFreakinRowWasSeen = lastMapFileImportTime;
+            suppressFindSplits();
 
             return null;
           }
@@ -1672,10 +1650,7 @@ public class Tablet {
         }
 
         log.warn("Cannot split tablet {} it contains a big row : {}", extent, lastRow);
-
-        sawBigRow = true;
-        timeOfLastMinCWhenBigFreakinRowWasSeen = lastMinorCompactionFinishTime;
-        timeOfLastImportWhenBigFreakinRowWasSeen = lastMapFileImportTime;
+        suppressFindSplits();
 
         return null;
       }
@@ -1694,9 +1669,7 @@ public class Tablet {
         log.warn("Cannot split tablet {}, selected split point too long.  Length :  {}", extent,
             text.getLength());
 
-        sawBigRow = true;
-        timeOfLastMinCWhenBigFreakinRowWasSeen = lastMinorCompactionFinishTime;
-        timeOfLastImportWhenBigFreakinRowWasSeen = lastMapFileImportTime;
+        suppressFindSplits();
 
         return null;
       }
@@ -1710,6 +1683,38 @@ public class Tablet {
 
   }
 
+  private boolean supressFindSplits = false;
+  private long timeOfLastMinCWhenFindSplitsWasSupressed = 0;
+  private long timeOfLastImportWhenFindSplitsWasSupressed = 0;
+
+  /**
+   * Check if the the current files were found to be unsplittable. If so, then do not want to spend
+   * resources on examining the files again until the files change.
+   */
+  private boolean isFindSplitsSuppressed() {
+    if (supressFindSplits) {
+      if (timeOfLastMinCWhenFindSplitsWasSupressed != lastMinorCompactionFinishTime
+          || timeOfLastImportWhenFindSplitsWasSupressed != lastMapFileImportTime) {
+        // a minor compaction or map file import has occurred... check again
+        supressFindSplits = false;
+      } else {
+        // nothing changed, do not split
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  /**
+   * Remember that the current set of files are unsplittable.
+   */
+  private void suppressFindSplits() {
+    supressFindSplits = true;
+    timeOfLastMinCWhenFindSplitsWasSupressed = lastMinorCompactionFinishTime;
+    timeOfLastImportWhenFindSplitsWasSupressed = lastMapFileImportTime;
+  }
+
   private static int longestCommonLength(Text text, Text beforeMid) {
     int common = 0;
     while (common < text.getLength() && common < beforeMid.getLength()