feat: add downgrade target for 2.1 (#23029)

pull/23034/head
William Baker 2021-12-29 13:27:07 -05:00 committed by GitHub
parent c889d0f22b
commit 4f74049a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -30,8 +30,11 @@ type migrationTarget struct {
kvMigration, sqlMigration int
}
// migrationTarget int values mean "migrate to this migration number". For example, kvMigration of 15 will result in the
// downgraded database including migration 15, but migration 15 will not be undone.
var downgradeMigrationTargets = map[string]migrationTarget{
"2.0": {kvMigration: 15, sqlMigration: 0},
"2.1": {kvMigration: 18, sqlMigration: 3},
}
func NewCommand(ctx context.Context, v *viper.Viper) (*cobra.Command, error) {

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -exo pipefail
declare -a DOWNGRADE_TARGETS=('2.0')
declare -a DOWNGRADE_TARGETS=('2.0' '2.1')
declare -r TEST_ORG=testorg
declare -r TEST_TOKEN=supersecretfaketoken
@ -17,6 +17,10 @@ function download_older_binary () {
dl_url=https://dl.influxdata.com/influxdb/releases/influxdb2-2.0.9-linux-amd64.tar.gz
dl_sha=64b9cfea1b5ca07479a16332056f9e7f806ad71df9c6cc0ec70c4333372b9d26
;;
2.1)
dl_url=https://dl.influxdata.com/influxdb/releases/influxdb2-2.1.1-linux-amd64.tar.gz
dl_sha=1688e3afa7f875d472768e4f4f5a909b357287a45a8f28287021e4184a185927
;;
*)
>&2 echo Error: Unknown downgrade target "'$target_version'"
exit 1