# Verify that pickAuto picks read triggered compactions that are scheduled and LSM is in good shape. This ensures
# that read triggered compactions are lower priority than score based ones. This also verifies that only the files
# within the range set in a readCompaction are chosen for compaction.
define
L5
  000101:a.SET.11-f.SET.12 size=10
  000102:g.SET.11-l.SET.12 size=10
L6
  000010:a.SET.1-f.SET.2 size=100
  000011:g.SET.1-l.SET.2 size=100
----
5:
  000101:[a#11,SET-f#12,SET]
  000102:[g#11,SET-l#12,SET]
6:
  000010:[a#1,SET-f#2,SET]
  000011:[g#1,SET-l#2,SET]

pick-auto
----
nil

add-read-compaction
5: a-f 000101
----

show-read-compactions
----
(level: 5, start: a, end: f)

pick-auto
----
L5 -> L6
L5: 000101
L6: 000010

show-read-compactions
----
(none)


# Verify that pickAuto does not pick read triggered compactions when the LSM is in bad shape and instead schedules a
# score-based one.
define
L5
  000101:a.SET.11-f.SET.12 size=1000000000
L6
  000010:a.SET.1-f.SET.2 size=1000000000
----
5:
  000101:[a#11,SET-f#12,SET]
6:
  000010:[a#1,SET-f#2,SET]

add-read-compaction
5: a-f 000101
----

show-read-compactions
----
(level: 5, start: a, end: f)

pick-auto
----
L5 -> L6
L5: 000101
L6: 000010

show-read-compactions
----
(level: 5, start: a, end: f)

# Verify that read compactions out of a level
# are disabled if the size ratio of level sizes
# is higher than what we want.
define
L5
  000101:a.SET.11-f.SET.12 size=10
  000102:g.SET.11-l.SET.12 size=10
L6
  000010:a.SET.1-f.SET.2 size=100000000
  000012:g.SET.1-l.SET.2 size=100
----
5:
  000101:[a#11,SET-f#12,SET]
  000102:[g#11,SET-l#12,SET]
6:
  000010:[a#1,SET-f#2,SET]
  000012:[g#1,SET-l#2,SET]

pick-auto
----
nil

add-read-compaction
5: a-f 000101
----

show-read-compactions
----
(level: 5, start: a, end: f)

pick-auto
----
nil

show-read-compactions
----
(none)

# Verify that wide read compactions are disabled.
define
L5
  000101:a.SET.11-f.SET.12 size=5000000
  000102:g.SET.11-l.SET.12 size=10
L6
  000010:a.SET.1-f.SET.2 size=100000000
  000012:g.SET.1-l.SET.2 size=100
----
5:
  000101:[a#11,SET-f#12,SET]
  000102:[g#11,SET-l#12,SET]
6:
  000010:[a#1,SET-f#2,SET]
  000012:[g#1,SET-l#2,SET]

pick-auto
----
nil

add-read-compaction
5: a-f 000101
----

show-read-compactions
----
(level: 5, start: a, end: f)

pick-auto
----
nil

show-read-compactions
----
(none)
