You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clusterversion: update M.4 runbook with onlyif directive guidance
Add expanded documentation to the M.4 runbook based on lessons learned:
1. Enhanced explanation in Commit 7 section about what onlyif/skipif
directives do and how to properly remove them:
- Explains that directives GUARD the next statement(s)
- Provides concrete example from udf_in_table showing wrong vs right
- Adds pattern: remove BOTH directive AND guarded statement
- Includes manual review steps after sed commands
2. New Error 6 in Common Errors section documenting 'relation already
exists' failures:
- Root cause: removing directive but not guarded statement
- Identification steps using git diff
- Fix steps with example from udf_in_table
- Prevention tips
These errors were encountered during PR #157767 and should help future
quarterly M.4 tasks avoid the same issues.
Release note: None
**Find all version keys below the new MinSupported** (e.g., all V25_2* keys when bumping to V25_3):
2960
+
**⚠️ IMPORTANT: DO NOT prefix the final release key (e.g., V25_2)**
2961
+
2962
+
The final release key (e.g., `V25_2`) is special and should NOT be prefixed with `TODO_Delete_` even when it becomes the old MinSupported version. Only prefix the internal version keys (e.g., `V25_2_Start`, `V25_2_AddSystemStatementHintsTable`).
2963
+
2964
+
**Why:** The final release keys are referenced in other parts of the codebase and tooling, and they serve as anchors for release tracking.
2965
+
2966
+
**Find all INTERNAL version keys below the new MinSupported** (e.g., all V25_2_* keys when bumping to V25_3):
2961
2967
2962
2968
```bash
2963
2969
# Example for bumping MinSupported from V25_2 to V25_3
**⚠️ IMPORTANT: DO NOT modify `pkg/sql/execversion/version.go`**
3038
+
3039
+
This file uses a separate versioning mechanism and is owned by the **SQL Queries team**. It should NOT be modified as part of the M.4 MinSupported bump task. If you see version references in this file during your search, leave them unchanged.
3030
3040
3031
3041
**Update each file** by changing references from the old MinSupported version to the new one.
3032
3042
3043
+
**CRITICAL: Update pkg/storage/pebble.go (around line 2459):**
3044
+
3045
+
When bumping MinSupported, you must also update the `MinimumSupportedFormatVersion` constant to match the Pebble format version for the new MinSupported version.
3046
+
3047
+
**How to determine the correct value:**
3048
+
1. Look at `pebbleFormatVersionMap` in the same file (around line 2450)
3049
+
2. Find the entry for the new MinSupported version (e.g., `clusterversion.V25_3`)
3050
+
3. Use that Pebble format version for `MinimumSupportedFormatVersion`
3051
+
3052
+
**Example for bumping MinSupported from V25_2 to V25_3:**
**⚠️ CRITICAL: Understanding `onlyif` and `skipif` Directives**
3348
+
3349
+
The `onlyif config` and `skipif config` directives in logic tests **guard the next statement(s)**:
3350
+
- `onlyif config local-mixed-25.2` → Run the next statement ONLY on local-mixed-25.2
3351
+
- `skipif config local-mixed-25.2` → Skip the next statement on local-mixed-25.2
3352
+
3353
+
**IMPORTANT: These two directives require DIFFERENT handling when removing a config:**
3354
+
3355
+
**Rule 1: For `onlyif config local-mixed-25.2` directives:**
3356
+
- Remove BOTH the directive AND the guarded statement(s)
3357
+
- The guarded statement is version-specific and won't be needed after the config is removed
3358
+
3359
+
**Rule 2: For `skipif config local-mixed-25.2` directives:**
3360
+
- Remove ONLY the directive itself
3361
+
- KEEP the guarded statement(s)
3362
+
- The guarded statement should run in all configs now that local-mixed-25.2 is removed
3363
+
3364
+
**Examples:**
3365
+
3366
+
```bash
3367
+
# Example1: onlyif directive (remove both directive AND statement)
3368
+
3369
+
# BEFORE:
3370
+
onlyif config local-mixed-25.2
3371
+
statement error pgcode 0A000 pq: unimplemented: usage of user-defined function
3372
+
CREATE TABLEt1(a INTPRIMARYKEY, b INTDEFAULTf1());
3373
+
3374
+
statement ok
3375
+
CREATE TABLEt1(a INTPRIMARYKEY, b INTDEFAULTf1());
3376
+
3377
+
# AFTER (CORRECT - removed both directive and guarded statement):
3378
+
statement ok
3379
+
CREATE TABLEt1(a INTPRIMARYKEY, b INTDEFAULTf1());
3380
+
3381
+
# Example2: skipif directive (remove ONLY directive, keep statement)
3382
+
3383
+
# BEFORE:
3384
+
skipif config local-mixed-25.2
3385
+
statement error pgcode 0A000 unimplemented: cannot evaluate function in this context
3386
+
ALTER TABLE test_tbl_t ADDCOLUMN c intAS (test_tbl_f()) stored;
3387
+
3388
+
# AFTER (CORRECT - removed only directive, kept statement):
3389
+
statement error pgcode 0A000 unimplemented: cannot evaluate function in this context
3390
+
ALTER TABLE test_tbl_t ADDCOLUMN c intAS (test_tbl_f()) stored;
3391
+
```
3392
+
3393
+
**Why the difference?**
3394
+
- `onlyif`: The guarded statement was ONLY for that specific config. Removing the config means we don't need that statement anymore (there's usually an unguarded version later)
3395
+
- `skipif`: The guarded statement was for ALL configs EXCEPT the one being removed. Now that we're removing that config, the statement should run everywhere
3396
+
3397
+
**Pattern to follow for `onlyif`:**
3398
+
1. Find `onlyif config local-mixed-25.2` line
3399
+
2. Identify what statement it guards (usually the next 3-10 lines until blank line or next directive)
3400
+
3. Remove BOTH the directive AND the guarded statement
3401
+
4. If this leaves an empty subtest or empty user block, remove those too
# Or if there are later commits, use interactive rebase:
3668
+
# (See the detailed instructions in Commit 2 section above)
3669
+
```
3670
+
3671
+
**Verification:**
3672
+
```bash
3673
+
./dev test pkg/storage -f TestMinimumSupportedFormatVersion -v
3674
+
```
3675
+
3676
+
Expected: Test passes.
3677
+
3678
+
**Reference:** This pattern is followed in all previous MinSupported bumps:
3679
+
- Commit accc0455bf9 (v25.1 → v25.2): Updated to `FormatTableFormatV6`
3680
+
- Commit 5807873f56f (v25.2 → v25.3): Updated to `FormatValueSeparation`
3681
+
3682
+
#### Error 2: Bazel generation failure after removing config
3516
3683
3517
3684
**Error:** `panic: unknown config name local-mixed-25.2`
3518
3685
@@ -3591,6 +3758,105 @@ git commit -m "..."
3591
3758
git add -A # Adds modifications AND deletions
3592
3759
```
3593
3760
3761
+
#### Error 6: "relation already exists" or duplicate statement errors in logic tests
3762
+
3763
+
**Error:** Test failures like:
3764
+
```
3765
+
expected success, but found
3766
+
(42P07) relation "test.public.t1" already exists
3767
+
```
3768
+
3769
+
**Cause:** Removed `onlyif config local-mixed-25.2` directives but forgot to remove the statements they guarded, resulting in duplicate statements that both execute.
3770
+
3771
+
**Example from udf_in_table:**
3772
+
```bash
3773
+
# File had two CREATE TABLE statements:
3774
+
# 1. Guarded by "onlyif config local-mixed-25.2" (lines 88-98)
3775
+
# 2. Unguarded default version (lines 533-547)
3776
+
3777
+
# After removing ONLY the directive (WRONG):
3778
+
statement ok
3779
+
CREATE TABLE t1(...) # ← Was guarded, now runs on all configs!
**Cause:** During rebase, git may auto-merge changes to `pebbleFormatVersionMap` incorrectly. The commit that removes `local-mixed-25.2` should only remove the V25_2 entry from this map, not change the V25_3 value.
3831
+
3832
+
**How to identify:**
3833
+
```bash
3834
+
# Check the pebble format version in the logictest removal commit
3835
+
git show <commit-sha>:pkg/storage/pebble.go | grep -A 4 "pebbleFormatVersionMap ="
3836
+
3837
+
# Compare with master to see what the correct V25_3 value should be
3838
+
git show master:pkg/storage/pebble.go | grep -A 4 "pebbleFormatVersionMap ="
3839
+
```
3840
+
3841
+
**Fix:**
3842
+
```bash
3843
+
# Start interactive rebase to edit the problematic commit
3844
+
git rebase -i <base-commit>
3845
+
3846
+
# Mark the commit with pebble.go for 'edit'
3847
+
# Then fix the file:
3848
+
# Edit pkg/storage/pebble.go to restore correct V25_3 value
3849
+
git add pkg/storage/pebble.go
3850
+
git commit --amend --no-edit
3851
+
git rebase --continue
3852
+
```
3853
+
3854
+
**Prevention:**
3855
+
- After rebase, always check `pkg/storage/pebble.go` changes carefully
3856
+
- The change should only be a deletion of the old version's line (V25_2)
3857
+
- Never change the values for existing newer versions (V25_3, V25_4, etc.)
3858
+
- Reference PR #147634 to verify the expected pattern
3859
+
3594
3860
### Quick Reference Commands
3595
3861
3596
3862
**Commit 1 - Prefix version keys:**
@@ -3606,9 +3872,15 @@ git commit -m "clusterversion: prefix version keys below 25.3 with TODO_Delete_.
0 commit comments