mirror of https://github.com/citusdata/citus.git
Actually connect to the right database in logical_replication test (#6211)
In the logical_replication test we test that the cleanup logic at the start of a shard move works as expected. To do so we create a subscription and publication slot manually. This changes the test to make that subscription actually connect to the database that the publication is in. Useful for #5987 #6085pull/6216/head
parent
dfa6c26d7d
commit
de475feb69
|
@ -21,16 +21,21 @@ NOTICE: localhost:xxxxx is the coordinator and already contains metadata, skipp
|
||||||
1
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- Create a publiction and subscription (including replication slot) manually.
|
||||||
|
-- This allows us to test the cleanup logic at the start of the shard move.
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
SET search_path TO logical_replication;
|
SET search_path TO logical_replication;
|
||||||
CREATE PUBLICATION citus_shard_move_publication_:postgres_oid FOR TABLE dist_6830000;
|
CREATE PUBLICATION citus_shard_move_publication_:postgres_oid FOR TABLE dist_6830000;
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
SET search_path TO logical_replication;
|
SET search_path TO logical_replication;
|
||||||
\set connection_string '\'user=postgres host=localhost port=' :worker_1_port '\''
|
CREATE TABLE dist_6830000(
|
||||||
|
id bigserial PRIMARY KEY
|
||||||
|
);
|
||||||
|
\set connection_string '\'user=postgres host=localhost port=' :worker_1_port ' dbname=regression\''
|
||||||
CREATE SUBSCRIPTION citus_shard_move_subscription_:postgres_oid
|
CREATE SUBSCRIPTION citus_shard_move_subscription_:postgres_oid
|
||||||
CONNECTION :connection_string
|
CONNECTION :connection_string
|
||||||
PUBLICATION citus_shard_move_publication_:postgres_oid
|
PUBLICATION citus_shard_move_publication_:postgres_oid
|
||||||
WITH (slot_name=citus_shard_move_slot_:postgres_oid);
|
WITH (enabled=false, slot_name=citus_shard_move_slot_:postgres_oid);
|
||||||
NOTICE: created replication slot "citus_shard_move_slot_10" on publisher
|
NOTICE: created replication slot "citus_shard_move_slot_10" on publisher
|
||||||
SELECT count(*) from pg_subscription;
|
SELECT count(*) from pg_subscription;
|
||||||
count
|
count
|
||||||
|
|
|
@ -17,17 +17,23 @@ INSERT INTO dist SELECT generate_series(1, 100);
|
||||||
|
|
||||||
SELECT 1 from citus_add_node('localhost', :master_port, groupId := 0);
|
SELECT 1 from citus_add_node('localhost', :master_port, groupId := 0);
|
||||||
|
|
||||||
|
-- Create a publiction and subscription (including replication slot) manually.
|
||||||
|
-- This allows us to test the cleanup logic at the start of the shard move.
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
SET search_path TO logical_replication;
|
SET search_path TO logical_replication;
|
||||||
CREATE PUBLICATION citus_shard_move_publication_:postgres_oid FOR TABLE dist_6830000;
|
CREATE PUBLICATION citus_shard_move_publication_:postgres_oid FOR TABLE dist_6830000;
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
SET search_path TO logical_replication;
|
SET search_path TO logical_replication;
|
||||||
\set connection_string '\'user=postgres host=localhost port=' :worker_1_port '\''
|
CREATE TABLE dist_6830000(
|
||||||
|
id bigserial PRIMARY KEY
|
||||||
|
);
|
||||||
|
\set connection_string '\'user=postgres host=localhost port=' :worker_1_port ' dbname=regression\''
|
||||||
CREATE SUBSCRIPTION citus_shard_move_subscription_:postgres_oid
|
CREATE SUBSCRIPTION citus_shard_move_subscription_:postgres_oid
|
||||||
CONNECTION :connection_string
|
CONNECTION :connection_string
|
||||||
PUBLICATION citus_shard_move_publication_:postgres_oid
|
PUBLICATION citus_shard_move_publication_:postgres_oid
|
||||||
WITH (slot_name=citus_shard_move_slot_:postgres_oid);
|
WITH (enabled=false, slot_name=citus_shard_move_slot_:postgres_oid);
|
||||||
|
|
||||||
|
|
||||||
SELECT count(*) from pg_subscription;
|
SELECT count(*) from pg_subscription;
|
||||||
SELECT count(*) from pg_publication;
|
SELECT count(*) from pg_publication;
|
||||||
|
|
Loading…
Reference in New Issue