-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cockroachdb cluster version fixups #6396
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,10 +153,22 @@ mod test { | |
); | ||
|
||
let settings = datastore.cockroachdb_settings(&opctx).await.unwrap(); | ||
// With a fresh cluster, this is the expected state | ||
let version = CockroachDbClusterVersion::NEWLY_INITIALIZED.to_string(); | ||
assert_eq!(settings.version, version); | ||
assert_eq!(settings.preserve_downgrade, ""); | ||
let version: CockroachDbClusterVersion = | ||
settings.version.parse().expect("unexpected cluster version"); | ||
if settings.preserve_downgrade == "" { | ||
// This is the expected value while running tests normally. | ||
assert_eq!(version, CockroachDbClusterVersion::NEWLY_INITIALIZED); | ||
} else if settings.preserve_downgrade == version.to_string() { | ||
// This is the expected value if the cluster was created on a | ||
// previous version and `cluster.preserve_downgrade_option` was set. | ||
assert_eq!(version, CockroachDbClusterVersion::POLICY); | ||
Comment on lines
+161
to
+164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This case needs to be added if, as part of doing tests, we create a cluster on an old version of CockroachDB and then set the |
||
} else { | ||
panic!( | ||
"`cluster.preserve_downgrade_option` is {:?}, | ||
but it should be empty or \"{}\"", | ||
settings.preserve_downgrade, version | ||
); | ||
} | ||
|
||
// Verify that if a fingerprint is wrong, we get the expected SQL error | ||
// back. | ||
|
@@ -165,7 +177,7 @@ mod test { | |
&opctx, | ||
String::new(), | ||
"cluster.preserve_downgrade_option", | ||
version.clone(), | ||
version.to_string(), | ||
) | ||
.await | ||
else { | ||
|
@@ -190,16 +202,16 @@ mod test { | |
&opctx, | ||
settings.state_fingerprint.clone(), | ||
"cluster.preserve_downgrade_option", | ||
version.clone(), | ||
version.to_string(), | ||
) | ||
.await | ||
.unwrap(); | ||
assert_eq!( | ||
datastore.cockroachdb_settings(&opctx).await.unwrap(), | ||
CockroachDbSettings { | ||
state_fingerprint: settings.state_fingerprint.clone(), | ||
version: version.clone(), | ||
preserve_downgrade: version.clone(), | ||
version: version.to_string(), | ||
preserve_downgrade: version.to_string(), | ||
} | ||
); | ||
} | ||
|
@@ -215,14 +227,24 @@ mod test { | |
) | ||
.await | ||
.unwrap(); | ||
assert_eq!( | ||
datastore.cockroachdb_settings(&opctx).await.unwrap(), | ||
CockroachDbSettings { | ||
state_fingerprint: settings.state_fingerprint.clone(), | ||
version: version.clone(), | ||
preserve_downgrade: String::new(), | ||
} | ||
); | ||
let settings = | ||
datastore.cockroachdb_settings(&opctx).await.unwrap(); | ||
if version == CockroachDbClusterVersion::NEWLY_INITIALIZED { | ||
assert_eq!( | ||
settings, | ||
CockroachDbSettings { | ||
state_fingerprint: settings.state_fingerprint.clone(), | ||
version: version.to_string(), | ||
preserve_downgrade: String::new(), | ||
} | ||
); | ||
} else { | ||
// Resetting it permits auto-finalization, so the state | ||
// fingerprint and version are not predictable until that | ||
// completes, but we can still verify that the variable was | ||
// reset. | ||
assert!(settings.preserve_downgrade.is_empty()); | ||
} | ||
} | ||
|
||
db.cleanup().await.unwrap(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The v22.1.9 artifact in this bucket is the same as the one found at the old URL, but I wanted to keep this consistent with the documentation in docs/crdb-upgrades.adoc.