Prevent taking the DDL lock without explicit authorization
authorCraig Ringer <craig@2ndquadrant.com>
Tue, 21 Apr 2015 13:10:28 +0000 (21:10 +0800)
committerCraig Ringer <craig@2ndquadrant.com>
Tue, 21 Apr 2015 13:15:26 +0000 (21:15 +0800)
commit330dd989d94b53cd8cf70d6a31d0f93b87599812
treed7fe0239f0c9af9b5e8cc5937fe463558347c35f
parent1f0ab1e4668822ce41fc393876eed54d9707c1de
Prevent taking the DDL lock without explicit authorization

Attempts to acquire the global DDL lock will now, by default,
ERROR with a message like:

ERROR: Global DDL locking attempt rejected by configuration
DETAIL: bdr.permit_ddl_locking is false and the attempted command would
require the global DDL lock to be acquired. Command rejected.
HINT: See the 'DDL replication chapter of the documentation.

Users/scripts which wish to execute DDL should:

BEGIN;
SET LOCAL bdr.permit_ddl_locking = true;
ALTER TABLE ....
COMMIT;

This will help prevent accidental DDL in things like user reports
from aborting transactions across the system and blocking user
writes. It's particularly useful where the DDL may be combined
with a transaction that does a large amount of row changes, as
there are performance issues with transactions that both do
DDL and change very large numbers of rows.

Future work will focus on progressively making the DDL lock finer
grained and less disruptive.
37 files changed:
Makefile.in
bdr.c
bdr.h
bdr_locks.c
doc/manual-ddl-replication.sgml
doc/manual-settings.sgml
expected/ddl/disable_ddl.out [new file with mode: 0644]
expected/ddl/enable_ddl.out [new file with mode: 0644]
expected/ddl/view.out
expected/dml/basic.out
expected/dml/contrib.out
expected/dml/delete_pk.out
expected/dml/extended.out
expected/dml/missing_pk.out
expected/dml/toasted.out
expected/init_bdr.out
expected/isolation/alter_table.out
expected/isolation/basic_triple_node.out
expected/isolation/ddlconflict.out
specs/isolation/alter_table.spec
specs/isolation/basic_triple_node.spec
specs/isolation/ddlconflict.spec
specs/isolation/dmlconflict_dd.spec
specs/isolation/dmlconflict_ii.spec
specs/isolation/dmlconflict_ud.spec
specs/isolation/dmlconflict_uu.spec
specs/isolation/update_pk_change_conflict.spec
sql/ddl/disable_ddl.sql [new file with mode: 0644]
sql/ddl/enable_ddl.sql [new file with mode: 0644]
sql/ddl/view.sql
sql/dml/basic.sql
sql/dml/contrib.sql
sql/dml/delete_pk.sql
sql/dml/extended.sql
sql/dml/missing_pk.sql
sql/dml/toasted.sql
sql/init_bdr.sql