Skip to content

Commit 988a435

Browse files
authored
Merge pull request #5149 from EnterpriseDB/BDR-4195-Docs-clarify-node-requirements-for-global-locks
Added clarifying notes to PGD locking criteria.
2 parents 65060d1 + 8a5f074 commit 988a435

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

product_docs/docs/pgd/5/ddl.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ function.
122122

123123
Two kinds of locks enforce correctness of replicated DDL with PGD.
124124

125+
### The global DDL lock
126+
125127
The first kind is known as a global DDL lock and is used only when `ddl_locking = on`.
126128
A global DDL lock prevents any other DDL from executing on the cluster while
127129
each DDL statement runs. This ensures full correctness in the general case but
@@ -133,7 +135,9 @@ another DDL command, even if it affects different tables.
133135

134136
To acquire a lock on DDL operations, the PGD node executing DDL contacts the
135137
other nodes in a PGD group and asks them to grant it the exclusive right to
136-
execute DDL. The lock request is sent by the regular replication stream, and the
138+
execute DDL.
139+
140+
The lock request is sent by the regular replication stream, and the
137141
nodes respond by the replication stream as well. So it's important that nodes (or
138142
at least a majority of the nodes) run without much replication
139143
delay. Otherwise it might take a long time for the node to acquire the DDL
@@ -150,6 +154,11 @@ take a long time to acquire the lock. Hence it's preferable to run DDLs from a
150154
single node or the nodes that have nearly caught up with replication changes
151155
originating at other nodes.
152156

157+
A global DDL Lock has to be granted by a majority of data and witness nodes where a majority is N/2+1
158+
of the eligible nodes. Subscriber-only nodes are not eligible to participate.
159+
160+
### The global DML lock
161+
153162
The second kind is known as a global DML lock or relation DML lock. This kind of lock is used when
154163
either `ddl_locking = on` or `ddl_locking = dml`, and the DDL statement might cause
155164
in-flight DML statements to fail. These failures can occur when you add or modify a constraint,
@@ -177,6 +186,10 @@ can be reached and are keeping up reasonably well with the current write rate.
177186
If such DDL commands must be performed while a node is down, first remove the
178187
down node from the configuration.
179188

189+
A global DML lock is granted when *ALL* the eligible data nodes agree to grant it.
190+
Witness and subscriber-only nodes are not eligible to participate.
191+
192+
180193
If a DDL statement isn't replicated, no global locks are acquired.
181194

182195
Locking behavior is specified by the `bdr.ddl_locking` parameter, as

0 commit comments

Comments
 (0)