static bool bdr_synchronous_commit;
int bdr_default_apply_delay;
int bdr_max_workers;
-bool bdr_log_applied_conflicts;
static bool bdr_skip_ddl_replication;
/*
0,
NULL, NULL, NULL);
- DefineCustomBoolVariable("bdr.log_applied_conflicts",
- "BDR usually only logs conflicts resolved by user handlers or where "
- "the remote row is discarded. If enabled, log records will also be "
- "written for rows where the local row is overwritten by a newer remote "
- "row.",
- NULL,
- &bdr_log_applied_conflicts,
- false,
- PGC_SIGHUP,
- 0,
- NULL, NULL, NULL);
-
/* if nothing is configured, we're done */
if (connections == NULL)
{
extern int bdr_max_workers;
extern char *bdr_temp_dump_directory;
extern bool bdr_init_from_basedump;
-extern bool bdr_log_applied_conflicts;
extern bool bdr_log_conflicts_to_table;
extern bool bdr_conflict_logging_include_tuples;
extern bool bdr_permit_unsafe_commands;
if (new_tuple)
*new_tuple = NULL;
+ *log_update = false;
+
if (local_node_id == replication_origin_id)
{
/*
* locking guarantees are met.
*/
*perform_update = true;
- *log_update = false;
return;
}
else
* If the caller doesn't provide storage for the conflict handler to
* store a new tuple in, don't fire any conflict triggers.
*/
- *log_update = true;
if (new_tuple)
{
* - Take no action and fall through to the next handling option
* --------------
*/
+
TimestampDifference(replication_origin_timestamp, local_ts,
&secs, µsecs);
if (skip)
{
+ *log_update = true;
*perform_update = false;
*resolution = BdrConflictResolution_ConflictTriggerSkipChange;
return;
}
else if (*new_tuple)
{
+ /* Custom conflict handler returned tuple, log it. */
+ *log_update = true;
*perform_update = true;
*resolution = BdrConflictResolution_ConflictTriggerReturnedTuple;
return;
else if (cmp < 0)
{
/* The most recent update is the local one; retain it */
+ *log_update = true;
*perform_update = false;
*resolution = BdrConflictResolution_LastUpdateWins_KeepLocal;
return;
* later.
*/
if (*perform_update)
+ {
*resolution = BdrConflictResolution_LastUpdateWins_KeepRemote;
+ }
else
+ {
*resolution = BdrConflictResolution_LastUpdateWins_KeepLocal;
+ *log_update = true;
+ }
return;
}
* local tuple is replaced by a newer remote tuple. Most of the time these
* are just noise, but there are times it's useful for debugging and tracing.
*/
- if (apply_remote && !bdr_log_applied_conflicts)
- return;
-
bdr_fetch_sysid_via_node_id(local_node_id,
&local_sysid, &local_tli,
bdr.permit_unsafe_ddl_commands = false
bdr.log_conflicts_to_table = True
-bdr.log_applied_conflicts = True
bdr.default_apply_delay = 100
track_commit_timestamp = on
step s1h: SELECT object_schema, object_name, conflict_type, conflict_resolution, local_tuple, remote_tuple, error_sqlstate FROM bdr.bdr_conflict_history ORDER BY conflict_id;
object_schema object_name conflict_type conflict_resolutionlocal_tuple remote_tuple error_sqlstate
-public test_dmlconflictinsert_insert last_update_wins_keep_remote{"a":"x","b":1,"c":"foo"}{"a":"y","b":1,"c":"bar"}
-public test_dmlconflictinsert_insert last_update_wins_keep_remote{"a":"y","b":1,"c":"bar"}{"a":"z","b":1,"c":"baz"}
step s2h: SELECT object_schema, object_name, conflict_type, conflict_resolution, local_tuple, remote_tuple, error_sqlstate FROM bdr.bdr_conflict_history ORDER BY conflict_id;
object_schema object_name conflict_type conflict_resolutionlocal_tuple remote_tuple error_sqlstate
public test_dmlconflictinsert_insert last_update_wins_keep_local{"a":"y","b":1,"c":"bar"}{"a":"x","b":1,"c":"foo"}
-public test_dmlconflictinsert_insert last_update_wins_keep_remote{"a":"y","b":1,"c":"bar"}{"a":"z","b":1,"c":"baz"}
step s3h: SELECT object_schema, object_name, conflict_type, conflict_resolution, local_tuple, remote_tuple, error_sqlstate FROM bdr.bdr_conflict_history ORDER BY conflict_id;
object_schema object_name conflict_type conflict_resolutionlocal_tuple remote_tuple error_sqlstate
step s1h: SELECT object_schema, object_name, conflict_type, conflict_resolution, local_tuple, remote_tuple, error_sqlstate FROM bdr.bdr_conflict_history ORDER BY conflict_id;
object_schema object_name conflict_type conflict_resolutionlocal_tuple remote_tuple error_sqlstate
-public test_dmlconflictupdate_update last_update_wins_keep_remote{"a":"x","b":1,"c":"foo"}{"a":"y","b":1,"c":"bar"}
-public test_dmlconflictupdate_update last_update_wins_keep_remote{"a":"y","b":1,"c":"bar"}{"a":"y","b":1,"c":"baz"}
step s2h: SELECT object_schema, object_name, conflict_type, conflict_resolution, local_tuple, remote_tuple, error_sqlstate FROM bdr.bdr_conflict_history ORDER BY conflict_id;
object_schema object_name conflict_type conflict_resolutionlocal_tuple remote_tuple error_sqlstate
public test_dmlconflictupdate_update last_update_wins_keep_local{"a":"y","b":1,"c":"bar"}{"a":"x","b":1,"c":"foo"}
-public test_dmlconflictupdate_update last_update_wins_keep_remote{"a":"y","b":1,"c":"bar"}{"a":"y","b":1,"c":"baz"}
step s3h: SELECT object_schema, object_name, conflict_type, conflict_resolution, local_tuple, remote_tuple, error_sqlstate FROM bdr.bdr_conflict_history ORDER BY conflict_id;
object_schema object_name conflict_type conflict_resolutionlocal_tuple remote_tuple error_sqlstate