github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/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 format=4 38 set bitablev2 bitablev2 39 ---- 40 41 # Ingest some external table written at earlier versions (i.e. Pebblev1, 42 # RocksDBv2, LevelDB). 43 44 ingest format=3 45 set bitablev1 bitablev1 46 ---- 47 48 ingest format=2 49 set rocksdbv2 rockdbv2 50 ---- 51 52 ingest format=1 53 set leveldb leveldb 54 ---- 55 56 lsm 57 ---- 58 0.0: 59 000005:[a#1,SET-a#1,SET] 60 6: 61 000009:[leveldb#5,SET-leveldb#5,SET] 62 000007:[bitablev1#3,SET-bitablev1#3,SET] 63 000006:[bitablev2#2,SET-bitablev2#2,SET] 64 000008:[rocksdbv2#4,SET-rocksdbv2#4,SET] 65 66 tally-table-formats 67 ---- 68 (LevelDB): 1 69 (RocksDB,v2): 1 70 (Pebble,v1): 1 71 (Pebble,v2): 2 72 73 # Upgrade the DB to FormatMinTableFormatPebblev1. 74 75 ratchet-format-major-version 009 76 ---- 77 78 format-major-version 79 ---- 80 009 81 82 # The min table format version has been raised to Pebblev1. 83 84 min-table-format 85 ---- 86 (Pebble,v1) 87 88 max-table-format 89 ---- 90 (Pebble,v2) 91 92 # Ingesting a table with a format prior to this version fails. 93 94 ingest format=2 95 set rocksdbv2 rockdbv2 96 ---- 97 bitable: table format (RocksDB,v2) is not within range supported at DB format major version 9, ((Pebble,v1),(Pebble,v2)) 98 99 # Upgrade the DB to FormatPrePebblev1Marked. The marked count increases to the 100 # count of tables at versions pre-Pebblev1 (i.e. two tables). 101 102 ratchet-format-major-version 010 103 ---- 104 105 format-major-version 106 ---- 107 010 108 109 min-table-format 110 ---- 111 (Pebble,v1) 112 113 max-table-format 114 ---- 115 (Pebble,v2) 116 117 marked-file-count 118 ---- 119 2 files marked for compaction 120 121 # Upgrade the DB to FormatPrePebblev1MarkedCompacted. The marked count returns 122 # to zero. 123 124 disable-automatic-compactions false 125 ---- 126 127 ratchet-format-major-version 011 128 ---- 129 130 format-major-version 131 ---- 132 011 133 134 min-table-format 135 ---- 136 (Pebble,v1) 137 138 max-table-format 139 ---- 140 (Pebble,v2) 141 142 marked-file-count 143 ---- 144 0 files marked for compaction 145 146 # The two tables with older table formats were rewritten with newer table format 147 # versions (note updated table numbers for the leveldb and rocksdb2 tables). 148 149 lsm 150 ---- 151 0.0: 152 000005:[a#1,SET-a#1,SET] 153 6: 154 000013:[leveldb#0,SET-leveldb#0,SET] 155 000007:[bitablev1#3,SET-bitablev1#3,SET] 156 000006:[bitablev2#2,SET-bitablev2#2,SET] 157 000012:[rocksdbv2#0,SET-rocksdbv2#0,SET] 158 159 # Confirm all tables are at least the minimum supported table format version. 160 161 tally-table-formats 162 ---- 163 (LevelDB): 0 164 (RocksDB,v2): 0 165 (Pebble,v1): 1 166 (Pebble,v2): 4