IF pg_replication_identifier_is_replaying() THEN
RETURN;
END IF;
+ IF current_setting('bdr.skip_ddl_replication')::boolean THEN
+ -- If we're doing a pg_restore from a remote BDR node's
+ -- state, we must not create truncate triggers etc because
+ -- they'll get copied over in the dump.
+ RETURN;
+ END IF;
FOR r IN SELECT * FROM pg_event_trigger_get_creation_commands()
LOOP
static char *bdr_synchronous_commit = NULL;
int bdr_default_apply_delay;
int bdr_max_workers;
+static bool bdr_skip_ddl_replication;
/* TODO: Remove when bdr_apply_main moved into bdr_apply.c */
extern BdrApplyWorker *bdr_apply_worker;
0,
NULL, NULL, NULL);
+ DefineCustomBoolVariable("bdr.skip_ddl_replication",
+ "Internal. Set during local restore during init_replica only",
+ NULL,
+ &bdr_skip_ddl_replication,
+ false,
+ PGC_BACKEND,
+ 0,
+ NULL, NULL, NULL);
+
/* if nothing is configured, we're done */
if (connections == NULL)
{
fi
echo "Restoring dump to local DB \"$TARGET\" with $JOBS concurrent workers from \"$TMPDIR\""
-if ! PGOPTIONS="-c bdr.permit_unsafe_ddl_commands=true" pg_restore --exit-on-error --single-transaction -j $JOBS -F d -d "$TARGET" $TMPDIR; then
+if ! PGOPTIONS="-c bdr.permit_unsafe_ddl_commands=true -c bdr.skip_ddl_replication=true" pg_restore --exit-on-error --single-transaction -j $JOBS -F d -d "$TARGET" $TMPDIR; then
echo "pg_restore to "$TARGET" failed, aborting"
exit 2
fi