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

     1  # Open the DB at one version prior to the version that enforces Pebblev1 tables.
     2  open version=8
     3  ----
     4  
     5  format-major-version
     6  ----
     7  008
     8  
     9  # Confirm the allowable range of table formats.
    10  
    11  min-table-format
    12  ----
    13  (LevelDB)
    14  
    15  max-table-format
    16  ----
    17  (Pebble,v2)
    18  
    19  # Disable automatic compactions while we create the tables.
    20  
    21  disable-automatic-compactions true
    22  ----
    23  
    24  # Create and flush a table. The table is created at the max format version for
    25  # this DB version (i.e. Pebblev2).
    26  
    27  batch
    28  set a a
    29  ----
    30  
    31  flush
    32  ----
    33  
    34  # Ingest an external table written at the max table format for the current
    35  # version (i.e. Pebblev2).
    36  
    37  ingest a format=pebblev2
    38  set pebblev2 pebblev2
    39  ----
    40  
    41  # Ingest some external table written at earlier versions (i.e. Pebblev1,
    42  # RocksDBv2, LevelDB).
    43  
    44  ingest b format=pebblev1
    45  set pebblev1 pebblev1
    46  ----
    47  
    48  ingest c format=rocksdbv2
    49  set rocksdbv2 rockdbv2
    50  ----
    51  
    52  ingest d format=leveldb
    53  set leveldb leveldb
    54  ----
    55  
    56  lsm
    57  ----
    58  0.0:
    59    000005:[a#10,SET-a#10,SET]
    60  6:
    61    000009:[leveldb#14,SET-leveldb#14,SET]
    62    000007:[pebblev1#12,SET-pebblev1#12,SET]
    63    000006:[pebblev2#11,SET-pebblev2#11,SET]
    64    000008:[rocksdbv2#13,SET-rocksdbv2#13,SET]
    65  
    66  tally-table-formats
    67  ----
    68  (LevelDB): 1
    69  (RocksDB,v2): 1
    70  (Pebble,v1): 1
    71  (Pebble,v2): 2
    72  (Pebble,v3): 0
    73  (Pebble,v4): 0
    74  
    75  # Upgrade the DB to FormatMinTableFormatPebblev1.
    76  
    77  ratchet-format-major-version 009
    78  ----
    79  
    80  format-major-version
    81  ----
    82  009
    83  
    84  # The min table format version has been raised to Pebblev1.
    85  
    86  min-table-format
    87  ----
    88  (Pebble,v1)
    89  
    90  max-table-format
    91  ----
    92  (Pebble,v2)
    93  
    94  # Ingesting a table with a format prior to this version fails.
    95  
    96  ingest e format=rocksdbv2
    97  set rocksdbv2 rockdbv2
    98  ----
    99  pebble: table format (RocksDB,v2) is not within range supported at DB format major version 9, ((Pebble,v1),(Pebble,v2))
   100  
   101  # Upgrade the DB to FormatPrePebblev1Marked. The marked count increases to the
   102  # count of tables at versions pre-Pebblev1 (i.e. two tables).
   103  
   104  ratchet-format-major-version 010
   105  ----
   106  
   107  format-major-version
   108  ----
   109  010
   110  
   111  min-table-format
   112  ----
   113  (Pebble,v1)
   114  
   115  max-table-format
   116  ----
   117  (Pebble,v2)
   118  
   119  marked-file-count
   120  ----
   121  2 files marked for compaction
   122  
   123  # Upgrade the DB to FormatPrePebblev1MarkedCompacted. The marked count returns
   124  # to zero.
   125  
   126  disable-automatic-compactions false
   127  ----
   128  
   129  ratchet-format-major-version 014
   130  ----
   131  
   132  format-major-version
   133  ----
   134  014
   135  
   136  min-table-format
   137  ----
   138  (Pebble,v1)
   139  
   140  max-table-format
   141  ----
   142  (Pebble,v3)
   143  
   144  marked-file-count
   145  ----
   146  0 files marked for compaction
   147  
   148  # The two tables with older table formats were rewritten with newer table format
   149  # versions (note updated table numbers for the leveldb and rocksdb2 tables).
   150  
   151  lsm
   152  ----
   153  0.0:
   154    000005:[a#10,SET-a#10,SET]
   155  6:
   156    000013:[leveldb#0,SET-leveldb#0,SET]
   157    000007:[pebblev1#12,SET-pebblev1#12,SET]
   158    000006:[pebblev2#11,SET-pebblev2#11,SET]
   159    000012:[rocksdbv2#0,SET-rocksdbv2#0,SET]
   160  
   161  # Confirm all tables are at least the minimum supported table format version.
   162  
   163  tally-table-formats
   164  ----
   165  (LevelDB): 0
   166  (RocksDB,v2): 0
   167  (Pebble,v1): 1
   168  (Pebble,v2): 4
   169  (Pebble,v3): 0
   170  (Pebble,v4): 0