bdr_apply_config->timeline == bdr_apply_worker->remote_timeline &&
bdr_apply_config->dboid == bdr_apply_worker->remote_dboid);
+ /*
+ * Got default remote connection info, read also local defaults.
+ * Otherwise we would be using replication sets and apply delay from the
+ * remote node instead of the local one.
+ *
+ * Note: this is slightly hacky and we should probably use the bdr_nodes
+ * for this instead.
+ */
+ if (!bdr_apply_config->origin_is_my_id &&
+ !bdr_apply_config->is_unidirectional)
+ {
+ BdrConnectionConfig *cfg =
+ bdr_get_connection_config(GetSystemIdentifier(), ThisTimeLineID,
+ MyDatabaseId, false);
+
+ bdr_apply_config->apply_delay = cfg->apply_delay;
+ pfree(bdr_apply_config->replication_sets);
+ bdr_apply_config->replication_sets = pstrdup(cfg->replication_sets);
+ bdr_free_connection_config(cfg);
+ }
+
CurrentResourceOwner = ResourceOwnerCreate(NULL, "bdr apply top-level resource owner");
bdr_saved_resowner = CurrentResourceOwner;
* node1: dbname regression, sets: default, important, for-node-1
* node2: dbname postgres, sets: default, important, for-node-2
*/
-\c regression
+\c postgres
CREATE TABLE settest_1(data text primary key);
INSERT INTO settest_1(data) VALUES ('should-replicate-via-default');
SELECT bdr.table_set_replication_sets('settest_1', '{}');
(2 rows)
-\c postgres
+\c regression
SELECT * FROM settest_1 ORDER BY data;
data
-----------------------------------------------------
should-replicate-via-for-node-2-even-though-unknown
(4 rows)
-\c regression
+\c postgres
DROP TABLE settest_1;
/*
* Now test configurations where only some actions are replicated.
(2 rows)
-\c postgres
+\c regression
SELECT * FROM settest_2 ORDER BY data;
data
------------------------------------
repl-update--insert-#4
(8 rows)
-\c regression
* node1: dbname regression, sets: default, important, for-node-1
* node2: dbname postgres, sets: default, important, for-node-2
*/
-\c regression
+\c postgres
CREATE TABLE settest_1(data text primary key);
SELECT * FROM settest_1 ORDER BY data;
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
-\c postgres
-SELECT * FROM settest_1 ORDER BY data;
\c regression
+SELECT * FROM settest_1 ORDER BY data;
+\c postgres
DROP TABLE settest_1;
SELECT * FROM settest_2 ORDER BY data;
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
-\c postgres
-SELECT * FROM settest_2 ORDER BY data;
\c regression
+SELECT * FROM settest_2 ORDER BY data;