github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/testdata/compaction_read_triggered (about)

     1  # A simple case of read compaction, 2 files in different levels with overlapping ranges
     2  define
     3  L5
     4  a.SET.55:a b.SET.5:b
     5  L6
     6  a.SET.54:a b.SET.4:b
     7  ----
     8  5:
     9    000004:[a#55,SET-b#5,SET]
    10  6:
    11    000005:[a#54,SET-b#4,SET]
    12  
    13  add-read-compaction
    14  5: a-b 000004
    15  ----
    16  
    17  show-read-compactions
    18  ----
    19  (level: 5, start: a, end: b)
    20  
    21  maybe-compact
    22  ----
    23  [JOB 100] compacted(read) L5 [000004] (784 B) + L6 [000005] (784 B) -> L6 [000006] (778 B), in 1.0s (2.0s total), output rate 778 B/s
    24  
    25  show-read-compactions
    26  ----
    27  (none)
    28  
    29  version
    30  ----
    31  6:
    32    000006:[a#0,SET-b#0,SET]
    33  
    34  # Check to make sure another compaction will not take place
    35  
    36  maybe-compact
    37  ----
    38  (none)
    39  
    40  # Case where there is an in-progress flush. No compaction should occur while flushing is true.
    41  define
    42  L5
    43  a.SET.55:a b.SET.5:b
    44  L6
    45  a.SET.54:a b.SET.4:b
    46  ----
    47  5:
    48    000004:[a#55,SET-b#5,SET]
    49  6:
    50    000005:[a#54,SET-b#4,SET]
    51  
    52  add-read-compaction flushing=true
    53  5: a-b 000004
    54  ----
    55  
    56  show-read-compactions
    57  ----
    58  (level: 5, start: a, end: b)
    59  
    60  maybe-compact
    61  ----
    62  (none)
    63  
    64  show-read-compactions
    65  ----
    66  (level: 5, start: a, end: b)
    67  
    68  version
    69  ----
    70  5:
    71    000004:[a#55,SET-b#5,SET]
    72  6:
    73    000005:[a#54,SET-b#4,SET]
    74  
    75  add-read-compaction flushing=false
    76  ----
    77  
    78  show-read-compactions
    79  ----
    80  (level: 5, start: a, end: b)
    81  
    82  maybe-compact
    83  ----
    84  [JOB 100] compacted(read) L5 [000004] (784 B) + L6 [000005] (784 B) -> L6 [000006] (778 B), in 1.0s (2.0s total), output rate 778 B/s
    85  
    86  show-read-compactions
    87  ----
    88  (none)
    89  
    90  version
    91  ----
    92  6:
    93    000006:[a#0,SET-b#0,SET]
    94  
    95  # Test case where there is mismatch in the level of chosen read compaction and current version.
    96  # In this case, we skip the compaction.
    97  define
    98  L5
    99  a.SET.55:a b.SET.5:b
   100  L6
   101  a.SET.55:a b.SET.5:b
   102  ----
   103  5:
   104    000004:[a#55,SET-b#5,SET]
   105  6:
   106    000005:[a#55,SET-b#5,SET]
   107  
   108  add-read-compaction
   109  4: a-b 000004
   110  ----
   111  
   112  show-read-compactions
   113  ----
   114  (level: 4, start: a, end: b)
   115  
   116  maybe-compact
   117  ----
   118  (none)
   119  
   120  show-read-compactions
   121  ----
   122  (none)
   123  
   124  version
   125  ----
   126  5:
   127    000004:[a#55,SET-b#5,SET]
   128  6:
   129    000005:[a#55,SET-b#5,SET]
   130  
   131  # The read compaction range overlaps with the appropriate level, but
   132  # the file number is different.
   133  # So, we skip the compaction.
   134  define
   135  L5
   136  a.SET.55:a b.SET.5:b
   137  L6
   138  a.SET.55:a b.SET.5:b
   139  ----
   140  5:
   141    000004:[a#55,SET-b#5,SET]
   142  6:
   143    000005:[a#55,SET-b#5,SET]
   144  
   145  add-read-compaction
   146  5: a-b 000003
   147  ----
   148  
   149  show-read-compactions
   150  ----
   151  (level: 5, start: a, end: b)
   152  
   153  maybe-compact
   154  ----
   155  (none)
   156  
   157  show-read-compactions
   158  ----
   159  (none)
   160  
   161  version
   162  ----
   163  5:
   164    000004:[a#55,SET-b#5,SET]
   165  6:
   166    000005:[a#55,SET-b#5,SET]