Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 10 additions & 1 deletion include/spock_conflict.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ extern bool spock_save_resolutions;
*/
typedef enum
{
/* The row to be inserted violates unique constraint */
/*
* The row to be inserted violates a unique constraint.
* This behaviour is controlled by GUC check_all_uc_indexes (default OFF).
* When ON, this conflict exactly matches PostgreSQL's INSERT_EXISTS
* conflict and Spock attempts to resolve it when any UNIQUE index rejects
* the insertion. It is counted as a conflict in subscription statistics
* and the exception log. When OFF, only a replica identity index
* violation is counted as a conflict; other index violations cause an
* ERROR and are not counted as conflicts.
*/
SPOCK_CT_INSERT_EXISTS = 0,

/* The row to be updated was modified by a different origin */
Expand Down
4 changes: 0 additions & 4 deletions include/spock_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,4 @@ extern bool wait_for_sync_status_change(Oid subid, const char *nspname,
extern void truncate_table(char *nspname, char *relname);
extern List *get_subscription_tables(Oid subid);

#ifdef WIN32
extern void QuoteWindowsArgv(StringInfo cmdline, const char *argv[]);
#endif

#endif /* SPOCK_SYNC_H */
14 changes: 9 additions & 5 deletions sql/spock--5.0.0--5.0.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ BEGIN
END IF;
END $$;

CREATE OR REPLACE FUNCTION spock.replicate_ddl(command text,
replication_sets text[] DEFAULT '{ddl_sql}',
search_path text DEFAULT current_setting('search_path'),
role text DEFAULT CURRENT_USER)
RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_replicate_ddl_command';
CREATE OR REPLACE FUNCTION spock.replicate_ddl(
command text,
replication_sets text[] DEFAULT '{ddl_sql}',
search_path text DEFAULT current_setting('search_path'),
role text DEFAULT CURRENT_USER
)
RETURNS boolean
AS 'MODULE_PATHNAME', 'spock_replicate_ddl_command'
LANGUAGE C STRICT VOLATILE;
21 changes: 15 additions & 6 deletions sql/spock--5.0.1--5.0.2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ ALTER TABLE spock.subscription

DROP FUNCTION spock.sub_create;

CREATE FUNCTION spock.sub_create(subscription_name name, provider_dsn text,
replication_sets text[] = '{default,default_insert_only,ddl_sql}', synchronize_structure boolean = false,
synchronize_data boolean = false, forward_origins text[] = '{}', apply_delay interval DEFAULT '0',
force_text_transfer boolean = false,
enabled boolean = true, skip_schema text[] = '{}')
RETURNS oid STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_create_subscription';
CREATE FUNCTION spock.sub_create(
subscription_name name,
provider_dsn text,
replication_sets text[] DEFAULT '{default,default_insert_only,ddl_sql}',
synchronize_structure boolean DEFAULT false,
synchronize_data boolean DEFAULT false,
forward_origins text[] DEFAULT '{}',
apply_delay interval DEFAULT '0',
force_text_transfer boolean DEFAULT false,
enabled boolean DEFAULT true,
skip_schema text[] DEFAULT '{}'
)
RETURNS oid
AS 'MODULE_PATHNAME', 'spock_create_subscription'
LANGUAGE C STRICT VOLATILE;


28 changes: 15 additions & 13 deletions sql/spock--5.0.6--6.0.0-devel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ DROP VIEW IF EXISTS spock.lag_tracker;
DROP TABLE IF EXISTS spock.progress;

DROP FUNCTION IF EXISTS spock.apply_group_progress;
CREATE FUNCTION spock.apply_group_progress (
OUT dbid oid,
OUT node_id oid,
OUT remote_node_id oid,
OUT remote_commit_ts timestamptz,
OUT prev_remote_ts timestamptz,
OUT remote_commit_lsn pg_lsn,
OUT remote_insert_lsn pg_lsn,
OUT received_lsn pg_lsn,
OUT last_updated_ts timestamptz,
OUT updated_by_decode bool
) RETURNS SETOF record
LANGUAGE c AS 'MODULE_PATHNAME', 'get_apply_group_progress';
CREATE FUNCTION spock.apply_group_progress(
OUT dbid oid,
OUT node_id oid,
OUT remote_node_id oid,
OUT remote_commit_ts timestamptz,
OUT prev_remote_ts timestamptz,
OUT remote_commit_lsn pg_lsn,
OUT remote_insert_lsn pg_lsn,
OUT received_lsn pg_lsn,
OUT last_updated_ts timestamptz,
OUT updated_by_decode bool
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'get_apply_group_progress'
LANGUAGE C;

-- Show the Spock apply progress for the current database
-- Columns prev_remote_ts, last_updated_ts, and updated_by_decode is dedicated
Expand Down
Loading
Loading