Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Check readonly mode in spock_alter_subscription_synchronize()
spock_alter_subscription_synchronize() iterates remote tables and calls
truncate_table() when truncate=true, but unlike spock_resync_table() it
was missing the check_readonly_for_resync() guard introduced in
SPOC-440. A readonly subscriber would have its tables truncated with no
way to refill them.

Add the guard and fix the missing forward declaration for
check_readonly_for_resync() (static function defined after its first
call site).

Co-Authored-By: Asif Rehman <asifr@pgedge.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
  • Loading branch information
3 people committed Mar 11, 2026
commit b220182ba8021ebb96d2cf84b4d91bbe4d1c862b
3 changes: 3 additions & 0 deletions src/spock_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ extern void gen_slot_name(Name slot_name, char *dbname,
const char *provider_name,
const char *subscriber_name);
static XLogRecPtr skip_wal_records_decoding(bool enable);
static void check_readonly_for_resync(const char *nspname, const char *relname);


bool in_spock_replicate_ddl_command = false;
Expand Down Expand Up @@ -957,6 +958,8 @@ spock_alter_subscription_synchronize(PG_FUNCTION_ARGS)
{
SpockSyncStatus newsync;

check_readonly_for_resync(remoterel->nspname, remoterel->relname);

memset(&newsync, 0, sizeof(SpockSyncStatus));
newsync.kind = SYNC_KIND_DATA;
newsync.subid = sub->id;
Expand Down
Loading