pkg/clusterversion/runbooks/M2_enable_mixed_cluster_logic_tests.md
This section provides step-by-step instructions for the M.2 task: "Enable mixed-cluster logic tests" on the master branch after M.1 has been completed. This task enables testing with the newly forked release version in mixed-cluster configurations.
When to perform: After M.1 is complete and the release branch exists. This is typically done shortly after the first beta is cut on the release branch.
What it does: Adds bootstrap data from the release branch and configures logic tests to run in mixed-cluster mode with the forked release version. This enables testing code changes against the previous release to catch compatibility issues early.
Dependencies:
release-25.4)Before starting, ensure:
release-25.4)Bootstrap data is a snapshot of the system catalog from the release version, used to simulate a cluster running that version.
a) Checkout the release branch:
git fetch origin release-25.4
git checkout origin/release-25.4
b) Build and run the sql-bootstrap-data tool:
./dev build sql-bootstrap-data && bin/sql-bootstrap-data
This command will:
pkg/sql/catalog/bootstrap/data/:
25_4_system.keys (~160KB)25_4_system.sha256 (64 bytes)25_4_tenant.keys (~155KB)25_4_tenant.sha256 (64 bytes)c) Copy the generated files to a temporary location:
cp pkg/sql/catalog/bootstrap/data/25_4_* /tmp/
d) Return to your working branch:
git checkout <your-m2-branch-name>
cp /tmp/25_4_* pkg/sql/catalog/bootstrap/data/
Add the bootstrap data mapping for the new version.
File: pkg/sql/catalog/bootstrap/initial_values.go
a) Add the bootstrap data mapping to initialValuesFactoryByKey (around line 66):
var initialValuesFactoryByKey = map[clusterversion.Key]initialValuesFactoryFn{
clusterversion.Latest: buildLatestInitialValues,
clusterversion.V25_2: hardCodedInitialValues{
system: v25_2_system_keys,
systemHash: v25_2_system_sha256,
nonSystem: v25_2_tenant_keys,
nonSystemHash: v25_2_tenant_sha256,
}.build,
clusterversion.V25_3: hardCodedInitialValues{
system: v25_3_system_keys,
systemHash: v25_3_system_sha256,
nonSystem: v25_3_tenant_keys,
nonSystemHash: v25_3_tenant_sha256,
}.build,
clusterversion.V25_4: hardCodedInitialValues{ // Add this entry
system: v25_4_system_keys,
systemHash: v25_4_system_sha256,
nonSystem: v25_4_tenant_keys,
nonSystemHash: v25_4_tenant_sha256,
}.build,
}
b) Add go:embed variables for the new files (at the end of the file, around line 162):
//go:embed data/25_4_system.keys
var v25_4_system_keys string
//go:embed data/25_4_system.sha256
var v25_4_system_sha256 string
//go:embed data/25_4_tenant.keys
var v25_4_tenant_keys string
//go:embed data/25_4_tenant.sha256
var v25_4_tenant_sha256 string
Add the new bootstrap data files to the build configuration.
File: pkg/sql/catalog/bootstrap/BUILD.bazel
Update embedsrcs (around line 10):
embedsrcs = [
"data/25_2_system.keys",
"data/25_2_system.sha256",
"data/25_2_tenant.keys",
"data/25_2_tenant.sha256",
"data/25_3_system.keys",
"data/25_3_system.sha256",
"data/25_3_tenant.keys",
"data/25_3_tenant.sha256",
"data/25_4_system.keys", # Add these 4 lines
"data/25_4_system.sha256",
"data/25_4_tenant.keys",
"data/25_4_tenant.sha256",
],
Add the mixed-cluster test configuration for the new version.
File: pkg/sql/logictest/logictestbase/logictestbase.go
a) Add the local-mixed-25.4 configuration (after the previous mixed config, around line 522):
{
// This config runs tests using 25.4 cluster version, simulating a node that
// is operating in a mixed-version cluster.
Name: "local-mixed-25.4",
NumNodes: 1,
OverrideDistSQLMode: "off",
BootstrapVersion: clusterversion.V25_4,
DisableUpgrade: true,
DeclarativeCorpusCollection: true,
},
b) Update default-configs set (around line 625):
"default-configs": makeConfigSet(
"local",
// ... other configs ...
"local-mixed-25.2",
"local-mixed-25.3",
"local-mixed-25.4", // Add this line
),
⚠️ IMPORTANT: Do NOT add cockroach-go-testserver-25.4 configuration in M.2. This configuration requires a predecessor binary (v25.4.0-rc.1) that is only added in M.3 after the first RC is published. See the "Common Errors" section for details.
Run bazel generation to create test files for the new configuration.
./dev gen bazel
This will generate test files in:
pkg/ccl/logictestccl/tests/local-mixed-25.4/pkg/sql/logictest/tests/local-mixed-25.4/pkg/sql/sqlitelogictest/tests/local-mixed-25.4/Add the generated directories to git:
git add pkg/ccl/logictestccl/tests/local-mixed-25.4/
git add pkg/sql/logictest/tests/local-mixed-25.4/
git add pkg/sql/sqlitelogictest/tests/local-mixed-25.4/
Note: The cockroach-go-testserver-25.4 directory should NOT be generated in M.2 (it will be added in M.3).
Some logic tests need to skip or adjust their expectations for mixed-cluster configurations.
Common file to update:
pkg/sql/logictest/testdata/logic_test/crdb_internal_catalogPattern: Look for skipif directives that include previous mixed versions and add the new one:
# Before:
skipif config schema-locked-disabled local-mixed-25.3
# After:
skipif config schema-locked-disabled local-mixed-25.3 local-mixed-25.4
How to find files that need updating:
# Search for skipif directives with previous mixed versions
grep -r "skipif.*local-mixed-25.3" pkg/sql/logictest/testdata/ --include="logic_test"
For each file found, add local-mixed-25.4 to the skipif list.
a) Run bootstrap tests:
./dev test pkg/sql/catalog/bootstrap -f TestInitialKeys -v
Expected: Test should pass with no errors.
b) Run a quick logictest with the new config:
./dev testlogic base --config=local-mixed-25.4 --files=crdb_internal_catalog -v
Expected: Tests should pass or skip appropriately.
c) Check file count:
git status --short | wc -l
Expected: Approximately 15-20 files changed (varies based on how many logictest files need skipif updates).
Add all changes and commit:
git add -A
git commit -m "bootstrap: enable 25.4 mixed-cluster logic tests
This change enables mixed-cluster logic tests for version 25.4 by adding
bootstrap data from release-25.4 and configuring the local-mixed-25.4 test
configuration.
The bootstrap data was obtained by running (on release-25.4 branch):
./dev build sql-bootstrap-data && bin/sql-bootstrap-data
Changes include:
- Added bootstrap data files (25_4_system.keys/sha256, 25_4_tenant.keys/sha256)
- Updated initial_values.go with V25_4 mapping
- Updated BUILD.bazel files with new bootstrap data embedsrcs
- Added local-mixed-25.4 logictest configuration
- Generated test files for local-mixed-25.4 config
- Updated logictests with skipif directives for local-mixed-25.4
Note: cockroach-go-testserver-25.4 configuration is NOT included in M.2.
It will be added in M.3 after the first RC binary is published and added
to REPOSITORIES.bzl.
Part of M.2 \"Enable mixed-cluster logic tests\" checklist.
Release note: None
Epic: None
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
"
A typical M.2 change should modify approximately 15-20 files:
Core changes (always modified):
pkg/sql/catalog/bootstrap/BUILD.bazel - Add bootstrap files to embedsrcspkg/sql/catalog/bootstrap/initial_values.go - Add V25_4 mappingpkg/sql/catalog/bootstrap/data/25_4_system.keys - New filepkg/sql/catalog/bootstrap/data/25_4_system.sha256 - New filepkg/sql/catalog/bootstrap/data/25_4_tenant.keys - New filepkg/sql/catalog/bootstrap/data/25_4_tenant.sha256 - New filepkg/sql/logictest/logictestbase/logictestbase.go - Add test configurationspkg/BUILD.bazel - Updated by ./dev gen bazel (binary file)Generated test files (always created):
9. pkg/ccl/logictestccl/tests/local-mixed-25.4/BUILD.bazel
10. pkg/ccl/logictestccl/tests/local-mixed-25.4/generated_test.go
11. pkg/sql/logictest/tests/local-mixed-25.4/BUILD.bazel
12. pkg/sql/logictest/tests/local-mixed-25.4/generated_test.go
13. pkg/sql/logictest/tests/cockroach-go-testserver-25.4/BUILD.bazel
14. pkg/sql/logictest/tests/cockroach-go-testserver-25.4/generated_test.go
15. pkg/sql/sqlitelogictest/tests/local-mixed-25.4/BUILD.bazel
16. pkg/sql/sqlitelogictest/tests/local-mixed-25.4/generated_test.go
Test expectation updates (may vary):
17. pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog - Update skipif
18. pkg/sql/logictest/tests/cockroach-go-testserver-25.2/generated_test.go - Regenerated
19. pkg/sql/logictest/tests/cockroach-go-testserver-25.3/generated_test.go - Regenerated
Note: The testserver generated_test.go files for 25.2 and 25.3 get regenerated because we added 25.4 to the testserver configs list.
This task is performed every quarter. Before creating the M.2 PR, validate that changes follow the expected pattern.
Find the most recent M.2 PR for reference. Note that some previous M.2 PRs may have been combined with M.1 changes.
Example standalone M.2 PRs:
Compare file lists:
# Get files changed in your current work
git diff --name-only <base-branch> | sort > /tmp/current_m2_files.txt
# Get files from a reference M.2 (adjust PR number)
gh pr view 156183 --json files --jq '.files[].path' | \
grep -E "(bootstrap/data|initial_values|BUILD.bazel|logictestbase|local-mixed|cockroach-go-testserver)" | \
sort > /tmp/previous_m2_files.txt
# Compare
echo "=== Files ONLY in current M.2 (investigate!) ==="
comm -13 /tmp/previous_m2_files.txt /tmp/current_m2_files.txt
echo "=== Files ONLY in previous M.2 (might be missing!) ==="
comm -23 /tmp/previous_m2_files.txt /tmp/current_m2_files.txt
Expected differences:
git diff --stat <base-branch> | tail -1
Expected: Approximately 15-20 files changed, 5000-5500 insertions.
# Check file sizes
ls -lh pkg/sql/catalog/bootstrap/data/25_4_*
Expected:
25_4_system.keys: ~160KB25_4_system.sha256: 64 bytes25_4_tenant.keys: ~155KB25_4_tenant.sha256: 64 bytes# Verify sha256 hashes match
cd pkg/sql/catalog/bootstrap/data
sha256sum 25_4_system.keys | awk '{print $1}' | diff - 25_4_system.sha256
sha256sum 25_4_tenant.keys | awk '{print $1}' | diff - 25_4_tenant.sha256
Expected: No output (hashes match).
# Bootstrap tests
./dev test pkg/sql/catalog/bootstrap -f TestInitialKeys -v
# Quick logictest
./dev testlogic base --config=local-mixed-25.4 --files=crdb_internal_catalog -v
Expected: All tests pass.
Before creating the PR, verify:
initial_values.go has V25_4 mapping and go:embed variablesBUILD.bazel includes all 4 new bootstrap fileslogictestbase.go has local-mixed-25.4 config (NOT cockroach-go-testserver-25.4)./dev gen bazel ran successfullyCause: Forgot to copy bootstrap files from release branch.
Fix:
./dev build sql-bootstrap-data && bin/sql-bootstrap-dataCause: go:embed variables not added to initial_values.go.
Fix: Add the 4 go:embed variable declarations at the end of initial_values.go.
Cause: M.1 not completed or working on wrong base branch.
Fix: Ensure your branch is based on the M.1 PR branch that has V25_4 defined.
Cause: ./dev gen bazel not run or failed.
Fix:
./dev gen bazel againCause: Bootstrap files corrupted or from wrong version.
Fix:
Cause: Bootstrap data not embedded correctly.
Fix:
./dev gen bazel to update build filesCause: cockroach-go-testserver-25.4 configuration was added in M.2, but it should only be added in M.3.
Why: The cockroach-go-testserver-25.4 configuration requires a predecessor version binary (v25.4.0-rc.1 or similar) to be available in pkg/sql/logictest/REPOSITORIES.bzl. These binaries are only added during M.3, after the first RC is published.
What to add in M.2:
local-mixed-25.4 configuration - ✅ This is correct for M.2What NOT to add in M.2:
cockroach-go-testserver-25.4 configuration - ❌ Save this for M.3cockroach-go-testserver-configs set - ❌ Save this for M.3cockroach-go-testserver-25.4 in BUILD.bazel - ❌ Save this for M.3Fix:
cockroach-go-testserver-25.4 config from logictestbase.gocockroach-go-testserver-configs setpkg/sql/logictest/tests/cockroach-go-testserver-25.4/ directorycockroach-go-testserver-25.4 visibility entries from pkg/sql/logictest/BUILD.bazel./dev gen bazel to regenerate filesReference: The cockroach-go-testserver-25.3 configuration was added in M.3 (commit b4a7d05d8e8), not M.2.
In the release cycle:
# Step 1: Generate bootstrap data
git checkout origin/release-25.4
./dev build sql-bootstrap-data && bin/sql-bootstrap-data
cp pkg/sql/catalog/bootstrap/data/25_4_* /tmp/
git checkout <your-m2-branch>
cp /tmp/25_4_* pkg/sql/catalog/bootstrap/data/
# Step 5: Generate test files
./dev gen bazel
git add pkg/ccl/logictestccl/tests/local-mixed-25.4/ \
pkg/sql/logictest/tests/local-mixed-25.4/ \
pkg/sql/logictest/tests/cockroach-go-testserver-25.4/ \
pkg/sql/sqlitelogictest/tests/local-mixed-25.4/
# Step 7: Verification
./dev test pkg/sql/catalog/bootstrap -f TestInitialKeys -v
./dev testlogic base --config=local-mixed-25.4 --files=crdb_internal_catalog -v
# Validate hashes
cd pkg/sql/catalog/bootstrap/data
sha256sum 25_4_system.keys | awk '{print $1}' | diff - 25_4_system.sha256
sha256sum 25_4_tenant.keys | awk '{print $1}' | diff - 25_4_tenant.sha256