From b87e290a866b022efb81ed770fcf5716bbb9d142 Mon Sep 17 00:00:00 2001 From: Oleg Afanasyev Date: Thu, 25 Aug 2022 17:03:21 +0100 Subject: [PATCH] roachtest: versionupgrade to check range splits and merges 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 --- pkg/cmd/roachtest/tests/acceptance.go | 4 +--- pkg/cmd/roachtest/tests/versionupgrade.go | 10 +++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/roachtest/tests/acceptance.go b/pkg/cmd/roachtest/tests/acceptance.go index 7265c2c2203c..be7fe981584b 100644 --- a/pkg/cmd/roachtest/tests/acceptance.go +++ b/pkg/cmd/roachtest/tests/acceptance.go @@ -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 diff --git a/pkg/cmd/roachtest/tests/versionupgrade.go b/pkg/cmd/roachtest/tests/versionupgrade.go index ccae65f35faa..f931af350218 100644 --- a/pkg/cmd/roachtest/tests/versionupgrade.go +++ b/pkg/cmd/roachtest/tests/versionupgrade.go @@ -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) { @@ -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,