Skip to content

Allow large object tables to join a replication set.#517

Open
ibrarahmad wants to merge 2 commits into
mainfrom
SPOC-583
Open

Allow large object tables to join a replication set.#517
ibrarahmad wants to merge 2 commits into
mainfrom
SPOC-583

Conversation

@ibrarahmad

Copy link
Copy Markdown
Contributor

Large objects stored by lolor were blocked from replication sets, so a DROP EXTENSION migrated them only on the node where it ran and left the other nodes with unreachable data. Split the skip list so lolor stays excluded from the structure-sync dump but may now be replicated.

Large objects stored by lolor were blocked from replication sets, so a
DROP EXTENSION migrated them only on the node where it ran and left the
other nodes with unreachable data. Split the skip list so lolor stays
excluded from the structure-sync dump but may now be replicated.
@ibrarahmad ibrarahmad requested a review from mason-sharp July 2, 2026 13:45
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

spock_node.c now separates replication-set eligibility checks from structure-sync dump exclusions, and a new TAP test verifies that lolor large-object tables can be added to a replication set and replicated. The test is also added to the scheduled TAP suite.

Changes

Replication Set Ignore List Refactor

Layer / File(s) Summary
Define norepset ignore lists and clarify dump exclusion comment
src/spock_node.c
Adds norepset_schema and norepset_extension arrays for replication-set-ineligible schemas and extensions, and clarifies the dump exclusion comment.
Rewire EnsureRelationNotIgnored to use norepset lists
src/spock_node.c
Updates EnsureRelationNotIgnored to check relations against norepset_schema and norepset_extension instead of the previous skip lists, with updated error detail messages.
Add lolor large-object replication-set test
tests/tap/schedule, tests/tap/t/032_lolor_largeobject_repset.pl
Adds the new TAP test to the schedule and implements the test flow that installs lolor, creates a cluster, exercises replication-set membership, and verifies large-object replication.

Sequence Diagram(s)

Not applicable; the change set is a validation refactor plus a TAP test addition.

Related PRs: None identified from provided context.

Suggested labels: bug, replication, tests

Suggested reviewers: None specified.

Poem

I hopped by the schema pond at night,
Sorting the lists just right.
One list for dumps, one list for sets,
And lolor joins the trail of nets.
With large objects blinking through,
This rabbit grins: “Hop, hop, do!” 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: allowing large object tables to be added to a replication set.
Description check ✅ Passed The description is directly related to the change and accurately explains the replication-set behavior fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SPOC-583

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.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/spock_node.c (1)

134-149: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate entries across skip_/norepset_ lists risk future drift.

norepset_schema/norepset_extension re-declare "snowflake" and "spock" that already exist in the (unchanged) skip_schema/skip_extension dump-exclusion lists. With four parallel static lists now needing manual sync, a future addition to one list (e.g. a new internal schema that must be excluded from both dumps and repsets) is easy to add to only one array and forget the other.

Consider deriving norepset_schema/norepset_extension from skip_schema/skip_extension minus the lolor entry (or vice versa), so there's a single source of truth for "internal, replication-unfriendly by default" objects, with lolor explicitly opted back in for repset membership.

♻️ Example approach
/*
 * Build norepset_* from skip_* at init time, excluding lolor, instead of
 * maintaining two independently-hand-written literal lists.
 */
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/spock_node.c` around lines 134 - 149, The replication-set exclusion lists
are duplicated across separate skip and norepset arrays, which can drift over
time. Update the logic around `norepset_schema` and `norepset_extension` in
`spock_node.c` so they are derived from the existing `skip_schema` and
`skip_extension` lists, with `lolor` explicitly excluded from the derived
replication-set bans. Keep a single source of truth for internal objects and
ensure both dump exclusion and repset exclusion stay in sync through the same
shared definition.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/spock_node.c`:
- Around line 134-149: The replication-set exclusion lists are duplicated across
separate skip and norepset arrays, which can drift over time. Update the logic
around `norepset_schema` and `norepset_extension` in `spock_node.c` so they are
derived from the existing `skip_schema` and `skip_extension` lists, with `lolor`
explicitly excluded from the derived replication-set bans. Keep a single source
of truth for internal objects and ensure both dump exclusion and repset
exclusion stay in sync through the same shared definition.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8cd09a0b-f010-4b2a-bb91-a9cf216a530a

📥 Commits

Reviewing files that changed from the base of the PR and between cf8421f and 69830b6.

📒 Files selected for processing (1)
  • src/spock_node.c

Verify lolor tables can join a replication set and replicate, that other
protected schemas stay blocked, and that add-node structure sync still
excludes lolor.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
tests/tap/t/032_lolor_largeobject_repset.pl (2)

34-47: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

No timeout on external clone/build; could hang CI indefinitely.

system("git clone ... $LOLOR_URL ...") and the subsequent make call have no timeout. If the network stalls or make hangs, the entire test run blocks rather than failing fast or falling through to skip_all.

🔧 Suggested fix using `timeout`
-    my $rc = system("git clone --depth 1 $LOLOR_URL $build >> '$log' 2>&1");
+    my $rc = system("timeout 60 git clone --depth 1 $LOLOR_URL $build >> '$log' 2>&1");
     return 0 if $rc != 0;
-    $rc = system("make -C $build USE_PGXS=1 PG_CONFIG='$PG/pg_config' install >> '$log' 2>&1");
+    $rc = system("timeout 120 make -C $build USE_PGXS=1 PG_CONFIG='$PG/pg_config' install >> '$log' 2>&1");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/tap/t/032_lolor_largeobject_repset.pl` around lines 34 - 47, The
ensure_lolor helper can hang CI because the git clone and make steps run without
any timeout handling. Update ensure_lolor to wrap the external clone/build
commands with a timeout-aware mechanism so they fail fast if the network stalls
or the build blocks, and then return 0 so the test can skip or fall through
cleanly. Keep the fix localized to ensure_lolor and its existing system() calls,
and preserve the current success checks for the lolor.control file.

39-39: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Hardcoded build directory can collide across parallel test runs.

/tmp/spock_lolor_build is a fixed path; if multiple CI jobs or repeated local runs execute this test concurrently on the same host, they will race on the same directory (the rm -rf in one run could delete another's in-progress clone).

Consider using a PID- or File::Temp-based unique path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/tap/t/032_lolor_largeobject_repset.pl` at line 39, The test setup in
032_lolor_largeobject_repset.pl uses a fixed build directory path, which can
collide when runs execute in parallel. Update the build path logic around the
$build variable to generate a unique per-run directory, such as one based on the
process ID or File::Temp, and keep the rest of the test using that dynamic path
so concurrent runs do not share or delete the same clone.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/tap/t/032_lolor_largeobject_repset.pl`:
- Around line 34-47: The ensure_lolor helper can hang CI because the git clone
and make steps run without any timeout handling. Update ensure_lolor to wrap the
external clone/build commands with a timeout-aware mechanism so they fail fast
if the network stalls or the build blocks, and then return 0 so the test can
skip or fall through cleanly. Keep the fix localized to ensure_lolor and its
existing system() calls, and preserve the current success checks for the
lolor.control file.
- Line 39: The test setup in 032_lolor_largeobject_repset.pl uses a fixed build
directory path, which can collide when runs execute in parallel. Update the
build path logic around the $build variable to generate a unique per-run
directory, such as one based on the process ID or File::Temp, and keep the rest
of the test using that dynamic path so concurrent runs do not share or delete
the same clone.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 899d14b9-0190-4022-8782-4fec1de70655

📥 Commits

Reviewing files that changed from the base of the PR and between 69830b6 and a41f22a.

📒 Files selected for processing (2)
  • tests/tap/schedule
  • tests/tap/t/032_lolor_largeobject_repset.pl
✅ Files skipped from review due to trivial changes (1)
  • tests/tap/schedule

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