@@ -30,6 +30,18 @@ maybeErr <- executeDatabaseContextExpr conn (Define "person" (attributesFromList
3030maybeErr <- executeGraphExpr conn (JumpToHead "branch2")
3131```
3232
33+## Dealing with Concurrency
34+
35+As in all databases, transactions contend concurrently for access to the the latest database state. Unlike most DBMSs, Project:M36 features multiple heads to reduce contention. Still, at a high transaction rate, Project:M36 clients would still be likely to receive lots of ```TransactionIsNotAHeadError```s because the server's head has received additional commits by the time a client wants to commit its own transaction. To reduce the incidence of this error, the server offers an ```autoMergeToHead``` function which:
36+
37+1. creates a temporary branch
38+1. commits the current disconnected transaction to the temporary branch
39+1. attempts a merge back to the original branch
40+
41+The operations above occur atomically on the server. The purpose of this "automerge" is to reduce reliance on repeated client attempts to commit when head contention is high. The trade-off is that the client must handle any merge errors or use a different merge strategy.
42+
43+This feature is similar to git's ```rebase``` functionality except that the merge occurs server side and is fully validated and committed, if possible.
44+
3345## Cleanup
3446
35471. Close the connection