open db
----
mkdir-all: db 0755
open-dir: db
lock: db/LOCK
open-dir: db
open-dir: db
open: db/CURRENT
create: db/MANIFEST-000001
sync: db/MANIFEST-000001
remove: db/temporary.000001.dbtmp
create: db/temporary.000001.dbtmp
sync: db/temporary.000001.dbtmp
close: db/temporary.000001.dbtmp
rename: db/temporary.000001.dbtmp -> db/CURRENT
sync: db
open-dir: db
sync: db/MANIFEST-000001
create: db/000002.log
sync: db
create: db/marker.manifest.000001.MANIFEST-000001
close: db/marker.manifest.000001.MANIFEST-000001
sync: db
create: db/marker.format-version.000001.002
close: db/marker.format-version.000001.002
sync: db
remove: db/temporary.000000.dbtmp
create: db/temporary.000000.dbtmp
sync: db/temporary.000000.dbtmp
close: db/temporary.000000.dbtmp
rename: db/temporary.000000.dbtmp -> db/CURRENT
create: db/marker.format-version.000002.003
close: db/marker.format-version.000002.003
remove: db/marker.format-version.000001.002
sync: db
create: db/marker.format-version.000003.004
close: db/marker.format-version.000003.004
remove: db/marker.format-version.000002.003
sync: db
create: db/marker.format-version.000004.005
close: db/marker.format-version.000004.005
remove: db/marker.format-version.000003.004
sync: db
create: db/marker.format-version.000005.006
close: db/marker.format-version.000005.006
remove: db/marker.format-version.000004.005
sync: db
create: db/marker.format-version.000006.007
close: db/marker.format-version.000006.007
remove: db/marker.format-version.000005.006
sync: db
create: db/marker.format-version.000007.008
close: db/marker.format-version.000007.008
remove: db/marker.format-version.000006.007
sync: db
create: db/marker.format-version.000008.009
close: db/marker.format-version.000008.009
remove: db/marker.format-version.000007.008
sync: db
create: db/marker.format-version.000009.010
close: db/marker.format-version.000009.010
remove: db/marker.format-version.000008.009
sync: db
create: db/marker.format-version.000010.011
close: db/marker.format-version.000010.011
remove: db/marker.format-version.000009.010
sync: db
create: db/marker.format-version.000011.012
close: db/marker.format-version.000011.012
remove: db/marker.format-version.000010.011
sync: db
create: db/marker.format-version.000012.013
close: db/marker.format-version.000012.013
remove: db/marker.format-version.000011.012
sync: db
create: db/marker.format-version.000013.014
close: db/marker.format-version.000013.014
remove: db/marker.format-version.000012.013
sync: db
create: db/marker.format-version.000014.015
close: db/marker.format-version.000014.015
remove: db/marker.format-version.000013.014
sync: db
create: db/marker.format-version.000015.016
close: db/marker.format-version.000015.016
remove: db/marker.format-version.000014.015
sync: db
create: db/temporary.000003.dbtmp
sync: db/temporary.000003.dbtmp
close: db/temporary.000003.dbtmp
rename: db/temporary.000003.dbtmp -> db/OPTIONS-000003
sync: db

batch db
set a 1
set b 2
set c 3
----
sync-data: db/000002.log

flush db
----
sync-data: db/000002.log
close: db/000002.log
create: db/000004.log
sync: db
create: db/000005.sst
sync-data: db/000005.sst
close: db/000005.sst
sync: db
sync: db/MANIFEST-000001

batch db
set b 5
set d 7
set e 8
----
sync-data: db/000004.log

flush db
----
sync-data: db/000004.log
close: db/000004.log
reuseForWrite: db/000002.log -> db/000006.log
sync: db
create: db/000007.sst
sync-data: db/000007.sst
close: db/000007.sst
sync: db
sync: db/MANIFEST-000001

batch db
set f 9
set g 10
----
sync-data: db/000006.log

checkpoint db checkpoints/checkpoint1
----
mkdir-all: checkpoints/checkpoint1 0755
open-dir: checkpoints
sync: checkpoints
close: checkpoints
open-dir: 
sync: 
close: 
open-dir: checkpoints/checkpoint1
link: db/OPTIONS-000003 -> checkpoints/checkpoint1/OPTIONS-000003
open-dir: checkpoints/checkpoint1
create: checkpoints/checkpoint1/marker.format-version.000001.016
sync-data: checkpoints/checkpoint1/marker.format-version.000001.016
close: checkpoints/checkpoint1/marker.format-version.000001.016
sync: checkpoints/checkpoint1
close: checkpoints/checkpoint1
link: db/000005.sst -> checkpoints/checkpoint1/000005.sst
link: db/000007.sst -> checkpoints/checkpoint1/000007.sst
open: db/MANIFEST-000001
create: checkpoints/checkpoint1/MANIFEST-000001
sync-data: checkpoints/checkpoint1/MANIFEST-000001
close: checkpoints/checkpoint1/MANIFEST-000001
close: db/MANIFEST-000001
open-dir: checkpoints/checkpoint1
create: checkpoints/checkpoint1/marker.manifest.000001.MANIFEST-000001
sync-data: checkpoints/checkpoint1/marker.manifest.000001.MANIFEST-000001
close: checkpoints/checkpoint1/marker.manifest.000001.MANIFEST-000001
sync: checkpoints/checkpoint1
close: checkpoints/checkpoint1
open: db/000006.log
create: checkpoints/checkpoint1/000006.log
sync-data: checkpoints/checkpoint1/000006.log
close: checkpoints/checkpoint1/000006.log
close: db/000006.log
sync: checkpoints/checkpoint1
close: checkpoints/checkpoint1

checkpoint db checkpoints/checkpoint1
----
checkpoint checkpoints/checkpoint1: file already exists

# Create a checkpoint that omits SSTs that don't overlap with the [d - f) range.
checkpoint db checkpoints/checkpoint2 restrict=(d-f)
----
mkdir-all: checkpoints/checkpoint2 0755
open-dir: checkpoints
sync: checkpoints
close: checkpoints
open-dir: checkpoints/checkpoint2
link: db/OPTIONS-000003 -> checkpoints/checkpoint2/OPTIONS-000003
open-dir: checkpoints/checkpoint2
create: checkpoints/checkpoint2/marker.format-version.000001.016
sync-data: checkpoints/checkpoint2/marker.format-version.000001.016
close: checkpoints/checkpoint2/marker.format-version.000001.016
sync: checkpoints/checkpoint2
close: checkpoints/checkpoint2
link: db/000007.sst -> checkpoints/checkpoint2/000007.sst
open: db/MANIFEST-000001
create: checkpoints/checkpoint2/MANIFEST-000001
sync-data: checkpoints/checkpoint2/MANIFEST-000001
close: checkpoints/checkpoint2/MANIFEST-000001
close: db/MANIFEST-000001
open-dir: checkpoints/checkpoint2
create: checkpoints/checkpoint2/marker.manifest.000001.MANIFEST-000001
sync-data: checkpoints/checkpoint2/marker.manifest.000001.MANIFEST-000001
close: checkpoints/checkpoint2/marker.manifest.000001.MANIFEST-000001
sync: checkpoints/checkpoint2
close: checkpoints/checkpoint2
open: db/000006.log
create: checkpoints/checkpoint2/000006.log
sync-data: checkpoints/checkpoint2/000006.log
close: checkpoints/checkpoint2/000006.log
close: db/000006.log
sync: checkpoints/checkpoint2
close: checkpoints/checkpoint2

# Create a checkpoint that omits SSTs that don't overlap with [a - e) and [d - f).
checkpoint db checkpoints/checkpoint3 restrict=(a-e, d-f)
----
mkdir-all: checkpoints/checkpoint3 0755
open-dir: checkpoints
sync: checkpoints
close: checkpoints
open-dir: checkpoints/checkpoint3
link: db/OPTIONS-000003 -> checkpoints/checkpoint3/OPTIONS-000003
open-dir: checkpoints/checkpoint3
create: checkpoints/checkpoint3/marker.format-version.000001.016
sync-data: checkpoints/checkpoint3/marker.format-version.000001.016
close: checkpoints/checkpoint3/marker.format-version.000001.016
sync: checkpoints/checkpoint3
close: checkpoints/checkpoint3
link: db/000005.sst -> checkpoints/checkpoint3/000005.sst
link: db/000007.sst -> checkpoints/checkpoint3/000007.sst
open: db/MANIFEST-000001
create: checkpoints/checkpoint3/MANIFEST-000001
sync-data: checkpoints/checkpoint3/MANIFEST-000001
close: checkpoints/checkpoint3/MANIFEST-000001
close: db/MANIFEST-000001
open-dir: checkpoints/checkpoint3
create: checkpoints/checkpoint3/marker.manifest.000001.MANIFEST-000001
sync-data: checkpoints/checkpoint3/marker.manifest.000001.MANIFEST-000001
close: checkpoints/checkpoint3/marker.manifest.000001.MANIFEST-000001
sync: checkpoints/checkpoint3
close: checkpoints/checkpoint3
open: db/000006.log
create: checkpoints/checkpoint3/000006.log
sync-data: checkpoints/checkpoint3/000006.log
close: checkpoints/checkpoint3/000006.log
close: db/000006.log
sync: checkpoints/checkpoint3
close: checkpoints/checkpoint3

compact db
----
sync-data: db/000006.log
close: db/000006.log
reuseForWrite: db/000004.log -> db/000008.log
sync: db
create: db/000009.sst
sync-data: db/000009.sst
close: db/000009.sst
sync: db
sync: db/MANIFEST-000001
open: db/000005.sst
read-at(630, 53): db/000005.sst
read-at(593, 37): db/000005.sst
read-at(74, 519): db/000005.sst
read-at(47, 27): db/000005.sst
open: db/000005.sst
close: db/000005.sst
open: db/000009.sst
read-at(625, 53): db/000009.sst
read-at(588, 37): db/000009.sst
read-at(69, 519): db/000009.sst
read-at(42, 27): db/000009.sst
open: db/000009.sst
close: db/000009.sst
open: db/000007.sst
read-at(630, 53): db/000007.sst
read-at(593, 37): db/000007.sst
read-at(74, 519): db/000007.sst
read-at(47, 27): db/000007.sst
open: db/000007.sst
close: db/000007.sst
open: db/000005.sst
read-at(0, 47): db/000005.sst
open: db/000007.sst
read-at(0, 47): db/000007.sst
create: db/000010.sst
close: db/000005.sst
open: db/000009.sst
read-at(0, 42): db/000009.sst
close: db/000007.sst
close: db/000009.sst
sync-data: db/000010.sst
close: db/000010.sst
sync: db
sync: db/MANIFEST-000001
close: db/000005.sst
close: db/000007.sst
close: db/000009.sst
remove: db/000005.sst
remove: db/000007.sst
remove: db/000009.sst

batch db
set h 11
----
sync-data: db/000008.log

list db
----
000006.log
000008.log
000010.sst
CURRENT
LOCK
MANIFEST-000001
OPTIONS-000003
marker.format-version.000015.016
marker.manifest.000001.MANIFEST-000001

list checkpoints/checkpoint1
----
000005.sst
000006.log
000007.sst
MANIFEST-000001
OPTIONS-000003
marker.format-version.000001.016
marker.manifest.000001.MANIFEST-000001

open checkpoints/checkpoint1 readonly
----
open-dir: checkpoints/checkpoint1
lock: checkpoints/checkpoint1/LOCK
open-dir: checkpoints/checkpoint1
open-dir: checkpoints/checkpoint1
open: checkpoints/checkpoint1/MANIFEST-000001
close: checkpoints/checkpoint1/MANIFEST-000001
open-dir: checkpoints/checkpoint1
open: checkpoints/checkpoint1/OPTIONS-000003
close: checkpoints/checkpoint1/OPTIONS-000003
open: checkpoints/checkpoint1/000006.log
close: checkpoints/checkpoint1/000006.log

scan checkpoints/checkpoint1
----
open: checkpoints/checkpoint1/000007.sst
read-at(630, 53): checkpoints/checkpoint1/000007.sst
read-at(593, 37): checkpoints/checkpoint1/000007.sst
read-at(74, 519): checkpoints/checkpoint1/000007.sst
read-at(47, 27): checkpoints/checkpoint1/000007.sst
read-at(0, 47): checkpoints/checkpoint1/000007.sst
open: checkpoints/checkpoint1/000005.sst
read-at(630, 53): checkpoints/checkpoint1/000005.sst
read-at(593, 37): checkpoints/checkpoint1/000005.sst
read-at(74, 519): checkpoints/checkpoint1/000005.sst
read-at(47, 27): checkpoints/checkpoint1/000005.sst
read-at(0, 47): checkpoints/checkpoint1/000005.sst
a 1
b 5
c 3
d 7
e 8
f 9
g 10
.

scan db
----
open: db/000010.sst
read-at(657, 53): db/000010.sst
read-at(620, 37): db/000010.sst
read-at(101, 519): db/000010.sst
read-at(74, 27): db/000010.sst
read-at(0, 74): db/000010.sst
a 1
b 5
c 3
d 7
e 8
f 9
g 10
h 11
.

# This checkpoint should only contain the second SST.
list checkpoints/checkpoint2
----
000006.log
000007.sst
MANIFEST-000001
OPTIONS-000003
marker.format-version.000001.016
marker.manifest.000001.MANIFEST-000001

open checkpoints/checkpoint2 readonly
----
open-dir: checkpoints/checkpoint2
lock: checkpoints/checkpoint2/LOCK
open-dir: checkpoints/checkpoint2
open-dir: checkpoints/checkpoint2
open: checkpoints/checkpoint2/MANIFEST-000001
close: checkpoints/checkpoint2/MANIFEST-000001
open-dir: checkpoints/checkpoint2
open: checkpoints/checkpoint2/OPTIONS-000003
close: checkpoints/checkpoint2/OPTIONS-000003
open: checkpoints/checkpoint2/000006.log
close: checkpoints/checkpoint2/000006.log

scan checkpoints/checkpoint2
----
open: checkpoints/checkpoint2/000007.sst
read-at(630, 53): checkpoints/checkpoint2/000007.sst
read-at(593, 37): checkpoints/checkpoint2/000007.sst
read-at(74, 519): checkpoints/checkpoint2/000007.sst
read-at(47, 27): checkpoints/checkpoint2/000007.sst
read-at(0, 47): checkpoints/checkpoint2/000007.sst
b 5
d 7
e 8
f 9
g 10
.

# This checkpoint should contain both SSTs.
list checkpoints/checkpoint3
----
000005.sst
000006.log
000007.sst
MANIFEST-000001
OPTIONS-000003
marker.format-version.000001.016
marker.manifest.000001.MANIFEST-000001

open checkpoints/checkpoint3 readonly
----
open-dir: checkpoints/checkpoint3
lock: checkpoints/checkpoint3/LOCK
open-dir: checkpoints/checkpoint3
open-dir: checkpoints/checkpoint3
open: checkpoints/checkpoint3/MANIFEST-000001
close: checkpoints/checkpoint3/MANIFEST-000001
open-dir: checkpoints/checkpoint3
open: checkpoints/checkpoint3/OPTIONS-000003
close: checkpoints/checkpoint3/OPTIONS-000003
open: checkpoints/checkpoint3/000006.log
close: checkpoints/checkpoint3/000006.log

scan checkpoints/checkpoint3
----
open: checkpoints/checkpoint3/000007.sst
read-at(630, 53): checkpoints/checkpoint3/000007.sst
read-at(593, 37): checkpoints/checkpoint3/000007.sst
read-at(74, 519): checkpoints/checkpoint3/000007.sst
read-at(47, 27): checkpoints/checkpoint3/000007.sst
read-at(0, 47): checkpoints/checkpoint3/000007.sst
open: checkpoints/checkpoint3/000005.sst
read-at(630, 53): checkpoints/checkpoint3/000005.sst
read-at(593, 37): checkpoints/checkpoint3/000005.sst
read-at(74, 519): checkpoints/checkpoint3/000005.sst
read-at(47, 27): checkpoints/checkpoint3/000005.sst
read-at(0, 47): checkpoints/checkpoint3/000005.sst
a 1
b 5
c 3
d 7
e 8
f 9
g 10
.
