Revert "channeldb: require minimum db upgrade version"

This reverts commit f1942a4c33dbea7144f756d9cd0139ab1fe8197f.
This commit is contained in:
Olaoluwa Osuntokun 2019-10-12 14:30:26 -07:00
parent 0386e0c297
commit e9d2ad5d73
2 changed files with 1 additions and 28 deletions

@ -1111,10 +1111,8 @@ func (d *DB) syncVersions(versions []version) error {
}
latestVersion := getLatestDBVersion(versions)
minUpgradeVersion := getMinUpgradeVersion(versions)
log.Infof("Checking for schema update: latest_version=%v, "+
"min_upgrade_version=%v, db_version=%v", latestVersion,
minUpgradeVersion, meta.DbVersionNumber)
"db_version=%v", latestVersion, meta.DbVersionNumber)
switch {
@ -1127,12 +1125,6 @@ func (d *DB) syncVersions(versions []version) error {
latestVersion)
return ErrDBReversion
case meta.DbVersionNumber < minUpgradeVersion:
log.Errorf("Refusing to upgrade from db_version=%d to "+
"latest_version=%d. Upgrade via intermediate major "+
"release(s).", meta.DbVersionNumber, latestVersion)
return ErrDBVersionTooLow
// If the current database version matches the latest version number,
// then we don't need to perform any migrations.
case meta.DbVersionNumber == latestVersion:
@ -1176,21 +1168,6 @@ func getLatestDBVersion(versions []version) uint32 {
return versions[len(versions)-1].number
}
// getMinUpgradeVersion returns the minimum version required to upgrade the
// database.
func getMinUpgradeVersion(versions []version) uint32 {
firstMigrationVersion := versions[0].number
// If we can upgrade from the base version with this version of lnd,
// return the base version as the minimum required version.
if firstMigrationVersion == 0 {
return 0
}
// Otherwise require the version that the first migration upgrades from.
return firstMigrationVersion - 1
}
// getMigrationsToApply retrieves the migration function that should be
// applied to the database.
func getMigrationsToApply(versions []version, version uint32) ([]migration, []uint32) {

@ -14,10 +14,6 @@ var (
// prior database version.
ErrDBReversion = fmt.Errorf("channel db cannot revert to prior version")
// ErrDBVersionTooLow is returned when detecting an attempt to upgrade a
// version for which migration is no longer supported.
ErrDBVersionTooLow = fmt.Errorf("channel db version too old to upgrade")
// ErrLinkNodesNotFound is returned when node info bucket hasn't been
// created.
ErrLinkNodesNotFound = fmt.Errorf("no link nodes exist")