BDR: DDL lock problem with function inside a schema

Started by Sylvain MARECHALalmost 11 years ago3 messagesgeneral
Jump to latest
#1Sylvain MARECHAL
marechal.sylvain2@gmail.com

Hello All,

I am doing some tests with BDR to study the ability of replacing
bucardo with BDR.

I experience some DDL locks problem when a function is in a schema, and
I try to remove the whole schema.

Node 1:
-----------
mydb=# CREATE SCHEMA IF NOT EXISTS test;
mydb=# CREATE OR REPLACE FUNCTION test.nothing() RETURNS void AS $$
BEGIN END; $$ LANGUAGE plpgsql;
CREATE FUNCTION

mydb=# drop schema test cascade ;
NOTICE: drop cascades to function test.nothing()
DROP SCHEMA

mydb=# \dn
List of schemas
Name | Owner
--------+----------
bdr | postgres
public | postgres
(2 rows)

Then if I switch to node 2
---------------------------------
List of schemas
Name | Owner
--------+----------
bdr | postgres
public | postgres
test | dbadmin
(3 rows)

mydb=# drop schema test cascade ;
ERROR: database is locked against ddl by another node
HINT: Node (6158090345987221693,1,17189) in the cluster is already
performing DDL

After that, I am not able to recover the situation: I tried to restart
postgres on both nodes, but nothing work for me. After that, it is not
possible anymore to do DDL operations:
- this "blocks" on node 1 (I do CTRL C to cancel the query in psql)
-on node 2, the message above "ERROR: database is locked against ddl by
another node" is displayed.
Additionally, I am not able to detach / reattach the node.

One workaround could be to remove first the function on _both_ nodes,
then to remove the schema, but what makes me not confident is that I
don't know how to recover the situation when such DDL locks operation
appear.

Questions:
---------------
-Is it a known bug? If yes should I report it (and where)?
-How to recover such DDL lock problems operation without recreating the
database? In other words, what is the proper way to cleanly restart both
nodes?
-Is it a well known method to properly detach and attach nodes?

Thanks and Regards,
Sylvain

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Craig Ringer
craig@2ndquadrant.com
In reply to: Sylvain MARECHAL (#1)
Re: BDR: DDL lock problem with function inside a schema

Questions:
---------------
-Is it a known bug? If yes should I report it (and where)?

Please open a report on github for this -
https://github.com/2ndQuadrant/bdr/issues

-How to recover such DDL lock problems operation without recreating the
database? In other words, what is the proper way to cleanly restart both
nodes?

Restarting both nodes should be sufficient, and I am surprised to see that
is not the case here. This needs more investigation.

-Is it a well known method to properly detach and attach nodes?

I'm not sure I understand.

If you mean join and remove nodes, join with bdr.bdr_group_join, remove
with bdr.bdr_part_by_node_names .

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

#3Sylvain MARECHAL
marechal.sylvain2@gmail.com
In reply to: Craig Ringer (#2)
Re: BDR: DDL lock problem with function inside a schema

Le 09/06/2015 02:29, Craig Ringer a écrit :

Questions:
---------------
-Is it a known bug? If yes should I report it (and where)?

Please open a report on github for this -
https://github.com/2ndQuadrant/bdr/issues

=> https://github.com/2ndQuadrant/bdr/issues/87

-How to recover such DDL lock problems operation without
recreating the database? In other words, what is the proper way to
cleanly restart both nodes?

Restarting both nodes should be sufficient, and I am surprised to see
that is not the case here. This needs more investigation.

-Is it a well known method to properly detach and attach nodes?

I'm not sure I understand.

If you mean join and remove nodes, join with bdr.bdr_group_join,
remove with bdr.bdr_part_by_node_names .

I was trying to find a way to recover the situation. I though that
detaching all nodes with bdr.bdr_part_by_node_names(), then reattaching
then with bdr.bdr_group_join() could help, but I did not succeed to do it.

In fact, this question is orthogonal / not related to the problem : I
just would like to detach /attach a node dynamically. Is it well
supported / planned to be supported ?

Thanks and Regards,
Sylvain