build
a.RANGEDEL.1:c
b.RANGEDEL.2:d
----
0: a#1,15-d#72057594037927935,15

iter
first
next
last
prev
----
d#72057594037927935,15:
.
a#1,15:
.

iter
seek-ge c
seek-ge d
seek-lt b
prev
----
d#72057594037927935,15:
.
a#1,15:
.

iter
seek-prefix-ge c
seek-prefix-ge d
seek-lt b
prev
----
d#72057594037927935,15:
.
a#1,15:
.

iter
seek-ge e
seek-lt a
----
.
.

iter
seek-prefix-ge e
seek-lt a
----
.
.

clear
----

build
a.SET.1:a
----
0: a#1,1-a#1,1

build
b.RANGEDEL.2:c
----
0: a#1,1-a#1,1
1: b#2,15-c#72057594037927935,15

build
c.SET.3:c
----
0: a#1,1-a#1,1
1: b#2,15-c#72057594037927935,15
2: c#3,1-c#3,1

iter
first
next
next
next
----
a#1,1:a
c#72057594037927935,15:
c#3,1:c
.

iter
last
prev
prev
prev
----
c#3,1:c
b#2,15:
a#1,1:a
.

clear
----

build
a.SET.1:b
b.RANGEDEL.2:c
----
0: a#1,1-c#72057594037927935,15

iter
first
next
next
----
a#1,1:b
c#72057594037927935,15:
.

iter
last
prev
----
a#1,1:b
.

clear
----

build
a.RANGEDEL.1:b
c.SET.2:c
----
0: a#1,15-c#2,1

iter
first
next
----
c#2,1:c
.

iter
last
prev
prev
----
c#2,1:c
a#1,15:
.

# Regression test to check that Seek{GE,LT} work properly in certain
# cases when then levelIter is positioned at a boundary key.

clear
----

build
d.SET.3:d
c.RANGEDEL.2:e
----
0: c#2,15-e#72057594037927935,15

iter
seek-ge d
next
seek-ge d
next
seek-lt e
prev
seek-ge d
prev
seek-lt e
----
d#3,1:d
e#72057594037927935,15:
d#3,1:d
e#72057594037927935,15:
d#3,1:d
c#2,15:
d#3,1:d
c#2,15:
d#3,1:d

# Regression test to check that Seek{GE,LT}, First, and Last do not
# have iteration bounds affected by SeekPrefixGE. Previously,
# SeekPrefixGE adjusted the iteration upper bound which would leak
# over to other positioning operations. While SeekPrefixGE no longer
# has this behavior, it is good to check the iteration bounds handling
# regardless.

clear
----

build
b.SET.4:b
d.SET.3:d
----
0: b#4,1-d#3,1

iter
seek-prefix-ge c
seek-ge d
next
----
.
d#3,1:d
.

iter
seek-prefix-ge c
seek-lt e
next
----
.
d#3,1:d
.

iter
seek-prefix-ge c
first
next
next
----
.
b#4,1:b
d#3,1:d
.

iter
seek-prefix-ge c
last
next
----
.
d#3,1:d
.

clear
----

build
a.SET.3:z
d.SET.4:z
----
0: a#3,1-d#4,1

build
e.SET.5:z
f.SET.6:z
g.RANGEDEL.2:h
----
0: a#3,1-d#4,1
1: e#5,1-h#72057594037927935,15

build
j.SET.6:z
----
0: a#3,1-d#4,1
1: e#5,1-h#72057594037927935,15
2: j#6,1-j#6,1

# Test cases to check that when the bounds are contained within a file, iterating
# beyond the bounds does not cause the levelIter to change to the next/prev file.
# This is not a correctness issue, but is a useful performance optimization and
# we want to verify that the code does what we want it to.
iter save
set-bounds lower=a upper=b
seek-ge a
next
----
a#3,1:z
.

file-pos
----
file 0

iter save continue
seek-prefix-ge a
next
----
a#3,1:z
.

file-pos
----
file 0

iter save continue
set-bounds lower=b upper=c
seek-ge b
----
.

file-pos
----
file 0

iter save continue
seek-prefix-ge b
----
.

file-pos
----
file 0

# Seek to an earlier position just as a sanity check.
iter save continue
set-bounds lower=a upper=b
seek-ge a
next
----
a#3,1:z
.

file-pos
----
file 0

iter save continue
set-bounds lower=d upper=e
seek-ge d
next
----
d#4,1:z
.

file-pos
----
file 1

iter save continue
seek-prefix-ge d
next
----
d#4,1:z
.

file-pos
----
file 1

iter save continue
set-bounds lower=e upper=f
seek-ge e
next
next
----
e#5,1:z
f#72057594037927935,15:
.

file-pos
----
file 1

iter save continue
seek-lt f
prev
prev
----
e#5,1:z
.
.

file-pos
----
file 0

iter save continue
set-bounds lower=f upper=g
seek-lt g
prev
prev
----
f#6,1:z
f#72057594037927935,15:
.

file-pos
----
file 1

iter continue
----
