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

     1  # Errors if the containing directory does not exist.
     2  locate dir=bar marker=foo
     3  ----
     4  open bar/: file does not exist
     5  
     6  mkdir-all data
     7  ----
     8  
     9  read dir=data marker=foo
    10  ----
    11  
    12  # Loads a nonexistent marker correctly.
    13  locate dir=data marker=foo
    14  ----
    15  
    16  next-iter  dir=data marker=foo
    17  ----
    18  1
    19  
    20  next-iter  dir=data marker=foo
    21  ----
    22  1
    23  
    24  # The directory should still be empty.
    25  list data
    26  ----
    27  
    28  # Moving the marker for the first time should create a marker file.
    29  move dir=data marker=foo
    30  MANIFEST-000010
    31  ----
    32  
    33  list data
    34  ----
    35  marker.foo.000001.MANIFEST-000010
    36  
    37  next-iter  dir=data marker=foo
    38  ----
    39  2
    40  
    41  read dir=data marker=foo
    42  ----
    43  MANIFEST-000010
    44  
    45  # Moving the marker should move the existing marker file.
    46  move dir=data marker=foo
    47  MANIFEST-000016
    48  ----
    49  
    50  next-iter  dir=data marker=foo
    51  ----
    52  3
    53  
    54  list data
    55  ----
    56  marker.foo.000002.MANIFEST-000016
    57  
    58  read dir=data marker=foo
    59  ----
    60  MANIFEST-000016
    61  
    62  # Create non-marker files.
    63  touch
    64  data/MANIFEST-000016
    65  data/CURRENT
    66  data/000004.sst
    67  ----
    68  
    69  # Re-locate the marker. It should be unchanged.
    70  locate dir=data marker=foo
    71  ----
    72  MANIFEST-000016
    73  
    74  # Locate a new marker.
    75  locate dir=data marker=bar
    76  ----
    77  
    78  move dir=data marker=bar
    79  MANIFEST-000016
    80  ----
    81  
    82  list data
    83  ----
    84  000004.sst
    85  CURRENT
    86  MANIFEST-000016
    87  marker.bar.000001.MANIFEST-000016
    88  marker.foo.000002.MANIFEST-000016
    89  
    90  move dir=data marker=foo
    91  MANIFEST-000021
    92  ----
    93  
    94  list data
    95  ----
    96  000004.sst
    97  CURRENT
    98  MANIFEST-000016
    99  marker.bar.000001.MANIFEST-000016
   100  marker.foo.000003.MANIFEST-000021
   101  
   102  touch
   103  data/marker.bar.000009.MANIFEST-000099
   104  ----
   105  
   106  list data
   107  ----
   108  000004.sst
   109  CURRENT
   110  MANIFEST-000016
   111  marker.bar.000001.MANIFEST-000016
   112  marker.bar.000009.MANIFEST-000099
   113  marker.foo.000003.MANIFEST-000021
   114  
   115  locate dir=data marker=bar
   116  ----
   117  MANIFEST-000099
   118  
   119  remove-obsolete dir=data marker=bar
   120  ----
   121  Removed 1 files.
   122  
   123  list data
   124  ----
   125  000004.sst
   126  CURRENT
   127  MANIFEST-000016
   128  marker.bar.000009.MANIFEST-000099
   129  marker.foo.000003.MANIFEST-000021
   130  
   131  read dir=data marker=bar
   132  ----
   133  MANIFEST-000099
   134  
   135  read dir=data marker=garbage
   136  ----