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

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


The following commit(s) were added to refs/heads/elasticity by this push:
     new 021d7d2a86 adds validation of file clipping to split code (#4627)
021d7d2a86 is described below

commit 021d7d2a865d7747c4c80246b6944f74c3cdc6a7
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Mon Jun 3 09:36:36 2024 -0400

    adds validation of file clipping to split code (#4627)
    
    When the split code examined files to determine if they
    should go to a child tablet it did not directly look at
    any ranges associated with the file becasue it assumed
    other code would clip.  Added validation that clipping
    was done since the file ranges are not directly examined
    by split.
    
    Ran ComprehensiveIT.testMergeAndSplit() to test this change
    because it does split->merge-split->merge while will cause
    split of tablets w/ fenced files.
---
 .../accumulo/manager/tableOps/split/UpdateTablets.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/UpdateTablets.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/UpdateTablets.java
index d8be0ab711..ce48d480b1 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/UpdateTablets.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/UpdateTablets.java
@@ -136,6 +136,21 @@ public class UpdateTablets extends ManagerRepo {
       Range fileRange;
       if (fileInfo != null) {
         fileRange = new Range(fileInfo.getFirstRow(), fileInfo.getLastRow());
+        if (!file.getRange().isInfiniteStartKey() || 
!file.getRange().isInfiniteStopKey()) {
+          // Its expected that if a file has a range that the first row and 
last row will be clipped
+          // to be within that range. For that reason this code does not check 
file.getRange() when
+          // making decisions about whether a file should go to a tablet, 
because its assumed that
+          // fileRange will cover that case. Since file.getRange() is not 
being checked directly
+          // this code validates the assumption that fileRange is within 
file.getRange()
+          Preconditions.checkState(
+              file.getRange().clip(new Range(fileInfo.getFirstRow()), false) 
!= null,
+              "First row %s computed for file %s did not fall in its range", 
fileInfo.getFirstRow(),
+              file);
+          Preconditions.checkState(
+              file.getRange().clip(new Range(fileInfo.getLastRow()), false) != 
null,
+              "Last row %s computed for file %s did not fall in its range", 
fileInfo.getLastRow(),
+              file);
+        }
       } else {
         fileRange = new Range();
       }

Reply via email to