Skip to content

Bump version to 5.1.0 and rename SQL scripts#401

Open
rasifr wants to merge 2 commits intomainfrom
task/SPOC-432/prepare-5.1.0-release
Open

Bump version to 5.1.0 and rename SQL scripts#401
rasifr wants to merge 2 commits intomainfrom
task/SPOC-432/prepare-5.1.0-release

Conversation

@rasifr
Copy link
Copy Markdown
Member

@rasifr rasifr commented Mar 27, 2026

    - Update SPOCK_VERSION to "5.1.0" and SPOCK_VERSION_NUM to 50100 in
  include/spock.h (spock.control is generated from this at build time)
- Rename sql/spock--6.0.0-devel.sql -> sql/spock--5.1.0.sql
- Rename sql/spock--5.0.6--6.0.0-devel.sql -> sql/spock--5.0.6--5.1.0.sql,
  update header comment and \echo version string
- Add ALTER COLUMN to fix sub_skip_schema column type in the upgrade script:
  the 5.0.1->5.0.2 migration added the column as plain `text`, but the
  fresh-install script has always declared it as `text[]`; align the
  upgrade path by casting: USING sub_skip_schema::text[]

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

📝 Walkthrough

Walkthrough

The changes coordinate a version downgrade from 6.0.0-devel to 5.1.0 across the codebase. Updates include version metadata, a migration script with schema column type and function definition changes, test version references, and a new comprehensive TAP test validating schema equivalence after upgrading from 5.0.6 to 5.1.0.

Changes

Cohort / File(s) Summary
Version Metadata
include/spock.h, tests/regress/sql/init_fail.sql
Updated extension version references from 6.0.0-devel to 5.1.0 in header constants and test initialization scripts.
Migration Script
sql/spock--5.0.6--5.1.0.sql
Added migration logic converting spock.subscription.sub_skip_schema column from text to text[], redefined md5_agg_sfunc() and spock_gen_slot_name() functions with updated signatures and parallelization attributes.
Test Infrastructure
tests/tap/schedule, tests/tap/t/018_upgrade_schema_match.pl
Added commented schedule entry and new comprehensive Perl TAP test script validating schema equivalence across in-place upgrade from Spock 5.0.6 to 5.1.0 with dual PostgreSQL node comparison.

Poem

🐰 From six-point-oh we hop back down,
To five-point-one, a version crown!
With schemas cast and functions bright,
Our upgrade test shall set things right—
A rabbit's leap through time and change! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Bump version to 5.1.0 and rename SQL scripts' accurately summarizes the main changes: updating version numbers and renaming SQL migration files.
Description check ✅ Passed The description clearly relates to the changeset by detailing all version updates, file renames, and schema migration fixes corresponding to the actual changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/SPOC-432/prepare-5.1.0-release

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

rasifr and others added 2 commits March 28, 2026 15:31
- Update SPOCK_VERSION to "5.1.0" and SPOCK_VERSION_NUM to 50100 in
  include/spock.h (spock.control is generated from this at build time)
- Rename sql/spock--6.0.0-devel.sql -> sql/spock--5.1.0.sql
- Rename sql/spock--5.0.6--6.0.0-devel.sql -> sql/spock--5.0.6--5.1.0.sql,
  update header comment and \echo version string
- Add ALTER COLUMN to fix sub_skip_schema column type in the upgrade script:
  the 5.0.1->5.0.2 migration added the column as plain `text`, but the
  fresh-install script has always declared it as `text[]`; align the
  upgrade path by casting: USING sub_skip_schema::text[]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verifies that upgrading Spock from 5.0.6 to 5.1.0 via ALTER EXTENSION
UPDATE produces a schema identical to a fresh 5.1.0 installation.

Each Spock version requires PostgreSQL built with its own branch-specific
patches, so the test maintains two separate PG installs.  When
V5_PG_INSTALL and V51_PG_INSTALL env vars point at pre-built installs,
all builds are skipped (fast path for local dev).  Otherwise PG and
Spock are built from source (CI path).

Test is excluded from the default schedule (slow); run via:
  V5_PG_INSTALL=... V51_PG_INSTALL=... prove t/018_upgrade_schema_match.pl

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rasifr rasifr force-pushed the task/SPOC-432/prepare-5.1.0-release branch from 868f54b to 1cf3438 Compare March 28, 2026 10:32
@rasifr
Copy link
Copy Markdown
Member Author

rasifr commented Mar 30, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/tap/t/018_upgrade_schema_match.pl (1)

150-165: Minor: Temporary file cleanup on early exit.

If psql_query dies between creating $tmpfile and the unlink, the temp file is left behind. Consider using a block-scoped cleanup or wrapping in eval.

♻️ Suggested improvement
 sub psql_query {
     my ($port, $sql) = `@_`;
     my $tmpfile = "/tmp/spock_018_$$.sql";
+    my $out;
     open my $fh, '>', $tmpfile or die "Cannot write $tmpfile: $!";
     print $fh $sql;
     close $fh;
-    open $fh, '-|', "$PG_BIN/psql", '-X', '-t', '-A',
-        '-p', $port, '-d', $DB_NAME, '-U', $DB_USER, '-f', $tmpfile
-        or die "Cannot run psql: $!";
-    my $out = join '', <$fh>;
-    close $fh;
-    unlink $tmpfile;
+    eval {
+        open $fh, '-|', "$PG_BIN/psql", '-X', '-t', '-A',
+            '-p', $port, '-d', $DB_NAME, '-U', $DB_USER, '-f', $tmpfile
+            or die "Cannot run psql: $!";
+        $out = join '', <$fh>;
+        close $fh;
+    };
+    my $err = $@;
+    unlink $tmpfile;
+    die $err if $err;
     chomp $out;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/tap/t/018_upgrade_schema_match.pl` around lines 150 - 165, psql_query
currently writes a temp file and may leave it behind if the function dies before
the final unlink; modify psql_query to guarantee cleanup by using a safe
temporary-file helper (e.g., File::Temp->new or a block-scoped temp file) or
wrap the write/psql invocation in an eval/finally-like construct (local $@; eval
{ ... }; my $err = $@; unlink $tmpfile if -e $tmpfile; die $err if $err) so that
the temp file is always removed; reference the psql_query function and the
$tmpfile variable when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/tap/t/018_upgrade_schema_match.pl`:
- Around line 150-165: psql_query currently writes a temp file and may leave it
behind if the function dies before the final unlink; modify psql_query to
guarantee cleanup by using a safe temporary-file helper (e.g., File::Temp->new
or a block-scoped temp file) or wrap the write/psql invocation in an
eval/finally-like construct (local $@; eval { ... }; my $err = $@; unlink
$tmpfile if -e $tmpfile; die $err if $err) so that the temp file is always
removed; reference the psql_query function and the $tmpfile variable when making
the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 87b0828a-fe94-4595-8692-810148ddddff

📥 Commits

Reviewing files that changed from the base of the PR and between a116148 and 1cf3438.

⛔ Files ignored due to path filters (2)
  • tests/regress/expected/init_1.out is excluded by !**/*.out
  • tests/regress/expected/init_fail.out is excluded by !**/*.out
📒 Files selected for processing (6)
  • include/spock.h
  • sql/spock--5.0.6--5.1.0.sql
  • sql/spock--5.1.0.sql
  • tests/regress/sql/init_fail.sql
  • tests/tap/schedule
  • tests/tap/t/018_upgrade_schema_match.pl

@rasifr rasifr marked this pull request as ready for review March 30, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant