on master help sign in
add some documentation for autoMergeToHead
commit55bbfa98aada2b0ff128649c824bd343e126b798 authorAgentM <agentm@themactionfaction.com> dateTue 1 Aug 2017, 10:54 (9 years ago) parentadd8d97
2 files changed+13−1
README.markdown+1−1 docs/projectm36_client_library.markdown+12
README.markdown+1−1
@@ -35,7 +35,7 @@ Project:M36 supports multiple frontends which target different audiences.
3535* [Developer's Blog](https://agentm.github.io/project-m36/)
3636* [Mailing List/Discussion Group](https://groups.google.com/d/forum/project-m36)
3737* IRC Channel: chat.freenode.net #project-m36
38−* [Hackage](https://hackage.haskell.org/package/project-m36-0.1)
38+* [Hackage](https://hackage.haskell.org/package/project-m36)
3939
4040## Documentation
4141
docs/projectm36_client_library.markdown+12
@@ -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