Re: BDR setup - bdr_node_join_wait_for_ready()

From: Martín Marqués <martin(at)2ndquadrant(dot)com>
To: cchee-ob <carter(dot)chee(at)objectbrains(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: BDR setup - bdr_node_join_wait_for_ready()
Date: 2015-08-31 00:25:13
Message-ID: 55E39EE9.7030306@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message marin 2015-08-31 06:29:13 Slave promotion problem...
Previous Message Martín Marqués 2015-08-30 22:06:07 Re: master/master replication with load balancer in front