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 */
16 changes: 0 additions & 16 deletions src/spock.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,28 +769,12 @@ spock_temp_directory_assing_hook(const char *newval, void *extra)
}
else
{
#ifndef WIN32
const char *tmpdir = getenv("TMPDIR");

if (!tmpdir)
tmpdir = "/tmp";
#else
char tmpdir[MAXPGPATH];
int ret;

ret = GetTempPath(MAXPGPATH, tmpdir);
if (ret == 0 || ret > MAXPGPATH)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not locate temporary directory: %s\n",
!ret ? strerror(errno) : "")));
return false;
}
#endif

spock_temp_directory = strdup(tmpdir);

}

if (spock_temp_directory == NULL)
Expand Down
6 changes: 6 additions & 0 deletions src/spock_exception_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ add_entry_to_exception_log(Oid remote_origin, TimestampTz remote_commit_ts,
* This function is invoked when the configured exception handling behavior is
* SUB_DISABLE, meaning the subscription must be suspended instead of skipping
* or retrying the failing transaction.
*
* May be called with or without an active transaction. If no transaction is
* in progress, one is started and committed internally. If the caller already
* holds an open transaction, it is the caller's responsibility to ensure that
* transaction is either committed or terminates with a FATAL error; otherwise
* the subscription state change and exception_log entry will be rolled back.
*/
void
spock_disable_subscription(SpockSubscription *sub,
Expand Down
Loading
Loading