github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/testdata/compaction_picker_read_triggered (about)

     1  # Verify that pickAuto picks read triggered compactions that are scheduled and LSM is in good shape. This ensures
     2  # that read triggered compactions are lower priority than score based ones. This also verifies that only the files
     3  # within the range set in a readCompaction are chosen for compaction.
     4  define
     5  L5
     6    000101:a.SET.11-f.SET.12 size=10
     7    000102:g.SET.11-l.SET.12 size=10
     8  L6
     9    000010:a.SET.1-f.SET.2 size=100
    10    000011:g.SET.1-l.SET.2 size=100
    11  ----
    12  5:
    13    000101:[a#11,SET-f#12,SET]
    14    000102:[g#11,SET-l#12,SET]
    15  6:
    16    000010:[a#1,SET-f#2,SET]
    17    000011:[g#1,SET-l#2,SET]
    18  
    19  pick-auto
    20  ----
    21  nil
    22  
    23  add-read-compaction
    24  5: a-f 000101
    25  ----
    26  
    27  show-read-compactions
    28  ----
    29  (level: 5, start: a, end: f)
    30  
    31  pick-auto
    32  ----
    33  L5 -> L6
    34  L5: 000101
    35  L6: 000010
    36  
    37  show-read-compactions
    38  ----
    39  (none)
    40  
    41  
    42  # Verify that pickAuto does not pick read triggered compactions when the LSM is in bad shape and instead schedules a
    43  # score-based one.
    44  define
    45  L5
    46    000101:a.SET.11-f.SET.12 size=1000000000
    47  L6
    48    000010:a.SET.1-f.SET.2 size=1000000000
    49  ----
    50  5:
    51    000101:[a#11,SET-f#12,SET]
    52  6:
    53    000010:[a#1,SET-f#2,SET]
    54  
    55  add-read-compaction
    56  5: a-f 000101
    57  ----
    58  
    59  show-read-compactions
    60  ----
    61  (level: 5, start: a, end: f)
    62  
    63  pick-auto
    64  ----
    65  L5 -> L6
    66  L5: 000101
    67  L6: 000010
    68  
    69  show-read-compactions
    70  ----
    71  (level: 5, start: a, end: f)
    72  
    73  # Verify that read compactions out of a level
    74  # are disabled if the size ratio of level sizes
    75  # is higher than what we want.
    76  define
    77  L5
    78    000101:a.SET.11-f.SET.12 size=10
    79    000102:g.SET.11-l.SET.12 size=10
    80  L6
    81    000010:a.SET.1-f.SET.2 size=100000000
    82    000012:g.SET.1-l.SET.2 size=100
    83  ----
    84  5:
    85    000101:[a#11,SET-f#12,SET]
    86    000102:[g#11,SET-l#12,SET]
    87  6:
    88    000010:[a#1,SET-f#2,SET]
    89    000012:[g#1,SET-l#2,SET]
    90  
    91  pick-auto
    92  ----
    93  nil
    94  
    95  add-read-compaction
    96  5: a-f 000101
    97  ----
    98  
    99  show-read-compactions
   100  ----
   101  (level: 5, start: a, end: f)
   102  
   103  pick-auto
   104  ----
   105  nil
   106  
   107  show-read-compactions
   108  ----
   109  (none)
   110  
   111  # Verify that wide read compactions are disabled.
   112  define
   113  L5
   114    000101:a.SET.11-f.SET.12 size=5000000
   115    000102:g.SET.11-l.SET.12 size=10
   116  L6
   117    000010:a.SET.1-f.SET.2 size=100000000
   118    000012:g.SET.1-l.SET.2 size=100
   119  ----
   120  5:
   121    000101:[a#11,SET-f#12,SET]
   122    000102:[g#11,SET-l#12,SET]
   123  6:
   124    000010:[a#1,SET-f#2,SET]
   125    000012:[g#1,SET-l#2,SET]
   126  
   127  pick-auto
   128  ----
   129  nil
   130  
   131  add-read-compaction
   132  5: a-f 000101
   133  ----
   134  
   135  show-read-compactions
   136  ----
   137  (level: 5, start: a, end: f)
   138  
   139  pick-auto
   140  ----
   141  nil
   142  
   143  show-read-compactions
   144  ----
   145  (none)