define
L1
d.SET.110:d e.SET.140:e
----
1:
  000004:[d#110,SET-e#140,SET] points:[d#110,SET-e#140,SET]

reopen
----
OK

# The current public Pebble interface offers no way of constructing a multi-file
# atomic compaction unit, so use the force-ingest command to force an ingestion
# into L1.

build cd
set c c
set d d
----

force-ingest paths=(cd) level=1
----
1:
  000008:[c#141,SET-d#141,SET] points:[c#141,SET-d#141,SET]
  000004:[d#110,SET-e#140,SET] points:[d#110,SET-e#140,SET]

format-major-version
----
005

marked-file-count
----
0 files marked for compaction

ratchet-format-major-version 006
----

format-major-version
----
006

# Upgrading to format major version 006 should've marked files for compaction.

marked-file-count
----
2 files marked for compaction

reopen
----
OK

format-major-version
----
006

# Ensure the files previously marked for compaction are still marked for
# compaction.

marked-file-count
----
2 files marked for compaction

disable-automatic-compactions false
----

# Ratcheting to 007 should force compaction of any files still marked for
# compaction.

ratchet-format-major-version 007
----
[JOB 100] compacted(rewrite) L1 [000008 000004] (1.6 K) + L1 [] (0 B) -> L1 [000013] (786 B), in 1.0s (2.0s total), output rate 786 B/s

format-major-version
----
007

lsm
----
1:
  000013:[c#0,SET-e#0,SET]

# Reset to a new LSM.

define
L1
b.SET.0:b c.SET.5:c
L1
m.SET.0:m l.SET.5:l
L1
x.SET.0:x y.SET.5:y
----
1:
  000004:[b#0,SET-c#5,SET] points:[b#0,SET-c#5,SET]
  000005:[l#5,SET-m#0,SET] points:[l#5,SET-m#0,SET]
  000006:[x#0,SET-y#5,SET] points:[x#0,SET-y#5,SET]

build ab
set a a
set b b
----

build wx
set w w
set x x
----

force-ingest paths=(ab, wx) level=1
----
1:
  000007:[a#6,SET-b#6,SET] points:[a#6,SET-b#6,SET]
  000004:[b#0,SET-c#5,SET] points:[b#0,SET-c#5,SET]
  000005:[l#5,SET-m#0,SET] points:[l#5,SET-m#0,SET]
  000008:[w#7,SET-x#7,SET] points:[w#7,SET-x#7,SET]
  000006:[x#0,SET-y#5,SET] points:[x#0,SET-y#5,SET]

format-major-version
----
005

ratchet-format-major-version 006
----

format-major-version
----
006

marked-file-count
----
4 files marked for compaction

disable-automatic-compactions false
----

ratchet-format-major-version 007
----
[JOB 100] compacted(rewrite) L1 [000007 000004] (1.6 K) + L1 [] (0 B) -> L1 [000010] (786 B), in 1.0s (2.0s total), output rate 786 B/s
[JOB 100] compacted(rewrite) L1 [000008 000006] (1.6 K) + L1 [] (0 B) -> L1 [000011] (786 B), in 1.0s (2.0s total), output rate 786 B/s

lsm
----
1:
  000010:[a#0,SET-c#0,SET]
  000005:[l#5,SET-m#0,SET]
  000011:[w#0,SET-y#0,SET]

format-major-version
----
007
