Revert "Change major db version check (#3241)" (#3421)

This reverts commit db7fa3d0ed.
This commit is contained in:
Alex Sharov 2022-02-04 09:21:10 +07:00 committed by GitHub
parent 71909c44db
commit bf9e109115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,8 +14,6 @@ import (
"github.com/ugorji/go/codec"
)
const MIN_MAJOR_VERSION = 3 // DB migrations before this number are removed - no way to migrate
// migrations apply sequentially in order of this array, skips applied migrations
// it allows - don't worry about merge conflicts and use switch branches
// see also dbutils.Migrations - it stores context in which each transaction was exectured - useful for bug-reports
@ -148,8 +146,9 @@ func (m *Migrator) Apply(db kv.RwDB, datadir string) error {
return fmt.Errorf("cannot downgrade minor DB version from %d.%d to %d.%d", major, minor, kv.DBSchemaVersion.Major, kv.DBSchemaVersion.Major)
}
} else {
if major < MIN_MAJOR_VERSION {
return fmt.Errorf("cannot upgrade major DB version from %d, minimum allowed version of db to apply DB migrations is %d, use integration tool if you know what you are doing", major, MIN_MAJOR_VERSION)
// major < kv.DBSchemaVersion.Major
if kv.DBSchemaVersion.Major-major > 1 {
return fmt.Errorf("cannot upgrade major DB version for more than 1 version from %d to %d, use integration tool if you know what you are doing", major, kv.DBSchemaVersion.Major)
}
}
}