Skip to content

Commit

Permalink
roachtest: versionupgrade to check range splits and merges
Browse files Browse the repository at this point in the history
This commit adds a test that peforms range split and merge during
cluster upgrade. This is covering test cases where raft state gets
additional information in new versions and we must ensure that
replicas don't diverge in the process of upgrade.

Release justification: Commit adds extra tests only.
Release note: None
  • Loading branch information
aliher1911 committed Aug 26, 2022
1 parent b43becb commit b87e290
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/cmd/roachtest/tests/acceptance.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ func registerAcceptance(r registry.Registry) {
registry.OwnerTestEng: {
{
name: "version-upgrade",
fn: func(ctx context.Context, t test.Test, c cluster.Cluster) {
runVersionUpgrade(ctx, t, c)
},
fn: runVersionUpgrade,
// This test doesn't like running on old versions because it upgrades to
// the latest released version and then it tries to "head", where head is
// the cockroach binary built from the branch on which the test is
Expand Down
10 changes: 9 additions & 1 deletion pkg/cmd/roachtest/tests/versionupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ CREATE DATABASE IF NOT EXISTS test;
CREATE TABLE test.t (x INT AS (3) STORED);
DROP TABLE test.t;
`),
stmtFeatureTest("Split and Merge Ranges", v202, `
create database if not EXISTS splitmerge;
create table splitmerge.t (k int primary key);
alter table splitmerge.t split at values (1), (2), (3);
alter table splitmerge.t unsplit at values (1), (2), (3);
drop table splitmerge.t;
`),
}

func runVersionUpgrade(ctx context.Context, t test.Test, c cluster.Cluster) {
Expand Down Expand Up @@ -138,8 +145,9 @@ func runVersionUpgrade(ctx context.Context, t test.Test, c cluster.Cluster) {
// and finalizing on the auto-upgrade path.
preventAutoUpgradeStep(1),
// Roll nodes forward.
binaryUpgradeStep(c.All(), ""),
binaryUpgradeStep(c.Node(1), ""),
testFeaturesStep,
binaryUpgradeStep(c.Range(2, c.Spec().NodeCount), ""),
// Run a quick schemachange workload in between each upgrade.
// The maxOps is 10 to keep the test runtime under 1-2 minutes.
// schemaChangeStep,
Expand Down

0 comments on commit b87e290

Please sign in to comment.