You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2017/08/08 16:36:17 UTC

[2/2] hive git commit: HIVE-17172 : add ordering checks to DiskRangeList (Sergey Shelukhin, reviewed by Deepak Jaiswal and Prasanth Jayachandran) ADDENDUM

HIVE-17172 : add ordering checks to DiskRangeList (Sergey Shelukhin, reviewed by Deepak Jaiswal and Prasanth Jayachandran) ADDENDUM


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

Branch: refs/heads/branch-2
Commit: 99a1aadae0cc71dd9f481a69017a22ae7d61eaf7
Parents: 40c9257
Author: sergey <se...@apache.org>
Authored: Tue Aug 8 09:33:32 2017 -0700
Committer: sergey <se...@apache.org>
Committed: Tue Aug 8 09:35:50 2017 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/common/io/DiskRangeList.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/99a1aada/storage-api/src/java/org/apache/hadoop/hive/common/io/DiskRangeList.java
----------------------------------------------------------------------
diff --git a/storage-api/src/java/org/apache/hadoop/hive/common/io/DiskRangeList.java b/storage-api/src/java/org/apache/hadoop/hive/common/io/DiskRangeList.java
index 1088e76..13494b6 100644
--- a/storage-api/src/java/org/apache/hadoop/hive/common/io/DiskRangeList.java
+++ b/storage-api/src/java/org/apache/hadoop/hive/common/io/DiskRangeList.java
@@ -124,6 +124,10 @@ public class DiskRangeList extends DiskRange {
   public DiskRangeList insertAfter(DiskRangeList other) {
     checkArg(other);
     checkOrder(this, other, this);
+    return insertAfterInternal(other);
+  }
+
+  private DiskRangeList insertAfterInternal(DiskRangeList other) {
     other.next = this.next;
     other.prev = this;
     if (this.next != null) {
@@ -180,8 +184,10 @@ public class DiskRangeList extends DiskRange {
    * @return the split list
    */
   public final DiskRangeList split(long cOffset) {
-    insertAfter((DiskRangeList)this.sliceAndShift(cOffset, end, 0));
-    return replaceSelfWith((DiskRangeList)this.sliceAndShift(offset, cOffset, 0));
+    DiskRangeList right = insertAfterInternal((DiskRangeList)this.sliceAndShift(cOffset, end, 0));
+    DiskRangeList left = replaceSelfWith((DiskRangeList)this.sliceAndShift(offset, cOffset, 0));
+    checkOrder(left, right, left); // Prev/next are already checked in the calls.
+    return left;
   }
 
   public boolean hasContiguousNext() {