Repository: hive
Updated Branches:
  refs/heads/branch-2 40c9257a7 -> 99a1aadae
  refs/heads/master 2b71ad306 -> f778e8c50


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/f778e8c5
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f778e8c5
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f778e8c5

Branch: refs/heads/master
Commit: f778e8c5023e04721892b481b8390c05c3b94c12
Parents: 2b71ad3
Author: sergey <ser...@apache.org>
Authored: Tue Aug 8 09:33:32 2017 -0700
Committer: sergey <ser...@apache.org>
Committed: Tue Aug 8 09:33:32 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/f778e8c5/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() {

Reply via email to