@@ -253,6 +253,12 @@ const (
253253 // Previously, marking for compaction required a manifest rotation.
254254 FormatMarkForCompactionInVersionEdit
255255
256+ // FormatTieredStorage is a format major version that adds support for
257+ // tiered storage based on the age of a key-value pair. It introduces a new
258+ // columnar block format (among other things) that is required for tracking
259+ // the attribute used to derive the age.
260+ FormatTieredStorage
261+
256262 // -- Add new versions here --
257263
258264 // FormatNewest is the most recent format major version.
@@ -293,6 +299,8 @@ func (v FormatMajorVersion) resolveDefault() FormatMajorVersion {
293299func (v FormatMajorVersion ) MaxTableFormat () sstable.TableFormat {
294300 v = v .resolveDefault ()
295301 switch {
302+ case v >= FormatTieredStorage :
303+ return sstable .TableFormatPebblev8
296304 case v >= formatFooterAttributes :
297305 return sstable .TableFormatPebblev7
298306 case v >= FormatTableFormatV6 :
@@ -398,6 +406,9 @@ var formatMajorVersionMigrations = map[FormatMajorVersion]func(*DB) error{
398406 FormatMarkForCompactionInVersionEdit : func (d * DB ) error {
399407 return d .finalizeFormatVersUpgrade (FormatMarkForCompactionInVersionEdit )
400408 },
409+ FormatTieredStorage : func (d * DB ) error {
410+ return d .finalizeFormatVersUpgrade (FormatTieredStorage )
411+ },
401412}
402413
403414const formatVersionMarkerName = `format-version`
@@ -511,7 +522,11 @@ func (d *DB) ratchetFormatMajorVersionLocked(formatVers FormatMajorVersion) erro
511522 defer func () { d .mu .formatVers .ratcheting = false }()
512523
513524 for nextVers := d .FormatMajorVersion () + 1 ; nextVers <= formatVers ; nextVers ++ {
514- if err := formatMajorVersionMigrations [nextVers ](d ); err != nil {
525+ migration , ok := formatMajorVersionMigrations [nextVers ]
526+ if ! ok || migration == nil {
527+ return errors .Errorf ("pebble: no migration function defined for format version %d" , nextVers )
528+ }
529+ if err := migration (d ); err != nil {
515530 return errors .Wrapf (err , "migrating to version %d" , nextVers )
516531 }
517532
0 commit comments