github.com/cockroachdb/pebble@v1.1.2/testdata/ingest_target_level (about)

     1  define
     2  ----
     3  
     4  # An empty LSM ingests into the bottom level.
     5  target
     6  a-b
     7  ----
     8  6
     9  
    10  define
    11  L5
    12    b.SET.1:1
    13    c.SET.2:2
    14  ----
    15  5:
    16    000004:[b#1,SET-c#2,SET]
    17  
    18  # Overlapping cases.
    19  target
    20  a-b
    21  b-c
    22  c-d
    23  ----
    24  4
    25  4
    26  4
    27  
    28  # Non-overlapping cases:
    29  # - Ingested file lies entirely before the existing file.
    30  # - Ingested file lies entirely after the existing file.
    31  # - Ingested file has no data overlap (falls through the middle of the existing
    32  #   file).
    33  target
    34  a-aa
    35  d-e
    36  bb-bb
    37  ----
    38  6
    39  6
    40  6
    41  
    42  define
    43  L0
    44    b.SET.3:3
    45    e.SET.4:4
    46  L0
    47    d.SET.5:5
    48    f.SET.6:6
    49  L0
    50    x.SET.7:7
    51    y.SET.8:8
    52  L3
    53    g.SET.1:1
    54    h.SET.2:2
    55  ----
    56  0.1:
    57    000005:[d#5,SET-f#6,SET]
    58  0.0:
    59    000004:[b#3,SET-e#4,SET]
    60    000006:[x#7,SET-y#8,SET]
    61  3:
    62    000007:[g#1,SET-h#2,SET]
    63  
    64  # Files overlap with L0. Files ingested into L0.
    65  target
    66  b-c
    67  d-e
    68  ----
    69  0
    70  0
    71  
    72  # Files overlap with L3. Files ingested into L2.
    73  target
    74  g-m
    75  ----
    76  2
    77  
    78  # No overlap. Files ingested into L6.
    79  target
    80  i-m
    81  c-c
    82  ----
    83  6
    84  6
    85  
    86  define
    87  L5
    88    a.SET.4:4
    89  L5
    90    c.SET.3:3
    91  L6
    92    a.SET.2:2
    93  L6
    94    c.SET.1:1
    95  ----
    96  5:
    97    000004:[a#4,SET-a#4,SET]
    98    000005:[c#3,SET-c#3,SET]
    99  6:
   100    000006:[a#2,SET-a#2,SET]
   101    000007:[c#1,SET-c#1,SET]
   102  
   103  # The ingested file slips through the gaps in both L5 and L6.
   104  target
   105  b-b
   106  ----
   107  6
   108  
   109  define
   110  L5
   111    a.SET.4:4
   112  L5
   113    c.SET.3:3
   114  L6
   115    a.SET.2:2
   116  L6
   117    c.SET.1:1
   118    compact:a-c
   119  ----
   120  5:
   121    000004:[a#4,SET-a#4,SET]
   122    000005:[c#3,SET-c#3,SET]
   123  6:
   124    000006:[a#2,SET-a#2,SET]
   125    000007:[c#1,SET-c#1,SET]
   126  
   127  # The ingested file cannot reach L6 as there is a compaction outputting a file
   128  # into the range [a,c].
   129  target
   130  b-b
   131  ----
   132  5
   133  
   134  define
   135  L0
   136    c.SET.4:4
   137    d.SET.3:3
   138    d.RANGEDEL.2:g
   139  L2
   140    a.RANGEDEL.1:g
   141  ----
   142  0.0:
   143    000004:[c#4,SET-g#inf,RANGEDEL]
   144  2:
   145    000005:[a#1,RANGEDEL-g#inf,RANGEDEL]
   146  
   147  # Overlapping cases:
   148  # - The ingested file overlaps with with [c,c].
   149  # - The rangedel over [d,g) keeps the ingested file in L0.
   150  # - Ditto.
   151  target
   152  c-c
   153  d-d
   154  e-e
   155  ----
   156  0
   157  0
   158  0
   159  
   160  # Non-overlapping cases:
   161  # - The ingested file [cc,cc] slips through L0, but is kept at L1 by the
   162  #   rangedel in L2.
   163  # - The ingested file is to completely to right of all files.
   164  # - The ingested file is to the left of all files in L0, but is kept at L1 by
   165  #   the rangedel in L2.
   166  target
   167  cc-cc
   168  g-g
   169  a-a
   170  ----
   171  1
   172  6
   173  1
   174  
   175  # A more complicated example demonstrating data overlap.
   176  #            |--|        ingested file: [d-e] - data overlap
   177  #          |-|           ingested file: [cc-d] - no data overlap
   178  #                |--|    ingested file: [ee-ff] - no data overlap
   179  #  |*--*--*----*------*| existing file: [a-g], points: [a, b, c, dd, g]
   180  #  _____________________
   181  #   a  b  c  d  e  f  g
   182  define
   183  L1
   184    a.SET.0:a
   185    b.SET.0:b
   186    c.SET.0:c
   187    dd.SET.0:dd
   188    g.SET.0:g
   189  ----
   190  1:
   191    000004:[a#0,SET-g#0,SET]
   192  
   193  # Data overlap.
   194  target
   195  d-e
   196  ----
   197  0
   198  
   199  # No data overlap.
   200  target
   201  cc-d
   202  ee-ff
   203  ----
   204  6
   205  6
   206  
   207  # Range key-point key data overlap will always correctly identify overlap because
   208  # we seek using the combined point and range key bounds of the ingested file
   209  # to determine overlap and don't check the data within the ingested file.
   210  define
   211  L5
   212    a.SET.0:a
   213    b.SET.0:b
   214    c.SET.0:c
   215  ----
   216  5:
   217    000004:[a#0,SET-c#0,SET]
   218  
   219  target
   220  rkey:a-c
   221  ----
   222  4
   223  
   224  # Point key-range key overlap
   225  define
   226  L5
   227    rangekey:a-c:{(#1,RANGEKEYSET,@t10,foo)}
   228  ----
   229  5:
   230    000004:[a#1,RANGEKEYSET-c#inf,RANGEKEYSET]
   231  
   232  target
   233  a-c
   234  ----
   235  4
   236  
   237  # Range key-range key overlap.
   238  define
   239  L5
   240    rangekey:a-c:{(#1,RANGEKEYSET,@t10,foo)}
   241  ----
   242  5:
   243    000004:[a#1,RANGEKEYSET-c#inf,RANGEKEYSET]
   244  
   245  target
   246  rkey:a-c
   247  ----
   248  4
   249  
   250  # Cases with boundary overlap and no data overlap. With suggest-split off
   251  # we get a target level of L0, but with suggest-split on, we get suggested
   252  # a file split.
   253  
   254  define
   255  L6
   256    a.SET.2:2
   257    d.SET.3:3
   258  L6
   259    f.SET.4:4
   260    k.SET.6:6
   261  ----
   262  6:
   263    000004:[a#2,SET-d#3,SET]
   264    000005:[f#4,SET-k#6,SET]
   265  
   266  target
   267  b-c
   268  e-g
   269  ----
   270  5
   271  5
   272  
   273  target suggest-split
   274  b-c
   275  e-g
   276  ----
   277  6 (split file: 000004)
   278  5
   279  
   280  target suggest-split
   281  g-i
   282  ----
   283  6 (split file: 000005)
   284  
   285  # suggest-split recognizes and avoids in-progress compactions.
   286  
   287  define
   288  L6
   289    a.SET.2:2
   290    d.SET.3:3
   291  L6
   292    f.SET.4:4
   293    k.SET.6:6
   294    compact:f-k
   295  ----
   296  6:
   297    000004:[a#2,SET-d#3,SET]
   298    000005:[f#4,SET-k#6,SET]
   299  
   300  target suggest-split
   301  g-i
   302  ----
   303  5
   304  
   305  # Ingestion splitting correctly recognizes data overlap in L6, and suggests
   306  # split in L5.
   307  
   308  define
   309  L5
   310    a.SET.2:2
   311    e.SET.3:3
   312  L6
   313    c.SET.1:1
   314    k.SET.1:1
   315  ----
   316  5:
   317    000004:[a#2,SET-e#3,SET]
   318  6:
   319    000005:[c#1,SET-k#1,SET]
   320  
   321  target suggest-split
   322  b-c
   323  ----
   324  5 (split file: 000004)