Skip to content

Commit 03bf112

Browse files
committed
Update dense node lock description
1 parent 69bdfad commit 03bf112

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

modules/ROOT/pages/database-internals/concurrent-data-access.adoc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,22 +257,19 @@ For these additional locks, no assumptions or guarantees can be made concerning
257257

258258
=== Locks for dense nodes
259259

260-
[NOTE]
261-
====
262-
This _Locks for dense nodes_ section describes the behavior of the `standard`, `aligned`, and `high_limit` store formats.
263-
The `block` format has a similar but not identical feature.
264-
====
265260

266-
A node is considered dense if it at any point has had 50 or more relationships (i.e. it will still be considered dense even if it comes to have less than 50 relationships at any point in the future).
261+
When creating or deleting relationships in Neo4j, dense nodes are not exclusively locked during a transaction.
262+
Rather, internally shared locks prevent the deletion of nodes, and shared degree locks are acquired for synchronizing with concurrent label changes for those nodes to ensure correct count updates.
263+
264+
In `standard`, `aligned`, and `high_limit` store formats node is considered dense if it at any point has had 50 or more relationships (i.e. it will still be considered dense even if it comes to have less than 50 relationships at any point in the future).
267265
A node is considered sparse if it has never had more than 50 relationships.
268266
You can configure the relationship count threshold for when a node is considered dense by setting xref:configuration/configuration-settings.adoc#config_db.relationship_grouping_threshold[`db.relationship_grouping_threshold`] configuration parameter.
269267

270-
When creating or deleting relationships in Neo4j, dense nodes are not exclusively locked during a transaction.
271-
Rather, internally shared locks prevent the deletion of nodes, and shared degree locks are acquired for synchronizing with concurrent label changes for those nodes to ensure correct count updates.
268+
In `block` format a node is considered dense for a particular relationship type. E.g a node can be dense for type A and sparse for type B. A node is considered dense for a particular relationship type when it has at one point surpassed a certain internal size threshold, which typically happens at approximately 50 relationships of that type, but depends on the number and size of properties connected to these relationships.
272269

273-
At commit time, relationships are inserted into their relationship chains at places that are currently uncontested (i.e. not currently modified by another transaction), and the surrounding relationships are exclusively locked.
270+
At commit time, relationships are inserted into the backing data structures in a manner that allows concurrent modification. I.e multiple transactions can create, update or delete relationships connected to the same dense nodes concurrently. This process may acquire additional are exclusive locks in a sorted manner if necessary, to ensure data consistency.
274271

275-
In other words, relationship modifications acquire coarse-grained shared node locks when doing the operation in the transaction, and then acquire precise exclusive relationship locks during commit.
272+
In other words, relationship modifications acquire coarse-grained shared node locks when doing the operation in the transaction, and then acquire precise exclusive locks during commit.
276273

277274
The locking is very similar for sparse and dense nodes.
278275
The biggest contention for sparse nodes is the update of the degree (i.e. number of relationships) for the node.

0 commit comments

Comments
 (0)