El 27/08/15 a las 13:35, cchee-ob escribió:
> What exactly does bdr_node_wait_for_ready() do? I've been trying to setup
> BDR on an existing database and once I run the select
> bdr.bdr_node_wait_for_ready(); command on the 2nd node after running the
> bdr.bdr_group_join() command it just hangs . I've done the same setup
> procedure on brand new nodes and have no issue with this command and BDR
> works fine. Is there anything that can be done to insure this command
> executes properly on an existing database?
The funtion is called bdr.bdr_node_join_wait_for_ready(), but I suppose
that's just a mistake when writing this mail.
As long as the node is still joining with the bdr group,
bdr.bdr_node_join_wait_for_ready() will not end.
It basically checks the node_status on bdr.bdr_nodes:
CREATE FUNCTION bdr.bdr_node_join_wait_for_ready()
RETURNS void LANGUAGE plpgsql VOLATILE AS $body$
DECLARE
_node_status "char";
BEGIN
IF current_setting('transaction_isolation') <> 'read committed' THEN
RAISE EXCEPTION 'Can only wait for node join in an ISOLATION
LEVEL READ COMMITTED transaction, not %',
current_setting('transaction_isolation');
END IF;
LOOP
SELECT INTO _node_status
node_status
FROM bdr.bdr_nodes
WHERE (node_sysid, node_timeline, node_dboid)
= bdr.bdr_get_local_nodeid();
PERFORM pg_sleep(0.5);
EXIT WHEN _node_status = 'r';
END LOOP;
END;
$body$;
BTW, why don't you the physical join procedure with bdr_init_copy to
join nodes?
Regards,
--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services