Skip to content

Commit 361d561

Browse files
markhannumakshatsikarwar
authored andcommitted
Documentation for replicant-retry-on-not-durable
Signed-off-by: Mark Hannum <mhannum72@gmail.com>
1 parent a0e3021 commit 361d561

3 files changed

Lines changed: 69 additions & 4 deletions

File tree

docs/_data/sidebars/mydoc_sidebar.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ entries:
134134
url: /ruleset.html
135135
output: web
136136

137-
- title: Operating databases
138-
url: /operations.html
139-
output: web
140-
folderitems:
137+
- title: Operating databases
138+
url: /operations.html
139+
output: web
140+
folderitems:
141141

142142
- title: Operational commands
143143
url: /op.html
@@ -151,6 +151,10 @@ entries:
151151
url: /physical_replication.html
152152
output: web
153153

154+
- title: Durable LSNs
155+
url: /durable_lsns.html
156+
output: web
157+
154158
- title: Examining logs
155159
url: /logs.html
156160
output: web

docs/pages/config/config_files.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ These options are toggle-able at runtime.
912912
|repchecksum | 0 | Enable to do additional check-summing of replication stream (log records in replication stream already have checksums)
913913
|replicant_latches | not set | ***Experimental*** Also acquire latches on replicants
914914
|replicate_local | 0 | When enabled, record all database events to a comdb2_oplog table. This can be used to set clusters/instances that are fed data from a database cluster. Alternate ways of doing this are planned, so enabling this option should not be needed in the near future.
915+
|replicant_retry_on_not_durable | 0 | If set, replicants will retry a transaction until it has been replicated to a quorum of the cluster.
915916
|report_deadlock_verbose | 0 | If set, dump the current thread's stack for every deadlock.
916917
|reqldiffstat | 60 (sec) | Set how often the database will dump various usage statistics (each entry will include changes in the last interval)
917918
|reqltruncate | 1 | Disable to always log full SQL queries in request logs (they are truncated by default to save space)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Durable LSNs
3+
keywords: durable, lsn
4+
sidebar: mydoc_sidebar
5+
permalink: durable_lsns.html
6+
---
7+
# Durable LSNs
8+
9+
## Coherency
10+
11+
The leader-node in comdb2 commits a transaction locally and then blocks until
12+
that transaction has been applied to all of the cluster's replicants. This is
13+
known as "distributed commit". Replicants that cannot apply the transaction
14+
within a certain timeout are marked 'incoherent', and are not allowed to
15+
service new requests.
16+
17+
A writing client is guaranteed to see the transaction it has just committed,
18+
because any node which hasn't applied the transaction will be marked
19+
incoherent, and will not handle new requests. This model preserves
20+
"reads-follows-writes" consistency.
21+
22+
If a different client reads the database while a writing client is blocked in
23+
distributed commit, the reading-client will see the writer's transaction if
24+
that replicant has already applied it. Our coherency model does not guarantee
25+
visibility of the commit until the writing client regains control. While the
26+
writer is blocked, a reader might observe the effects of the transaction on
27+
replicant A, and then not see those effects on replicant B.
28+
29+
## Durability
30+
31+
A "durable" transaction cannot be unwound by a future leader. When the
32+
'elect\_highest\_committed\_gen' tunable is enabled, a transaction is
33+
considered durable once it has been applied to a quorum of the cluster's
34+
replicants. Because elections require a quorum of nodes to promote a new
35+
leader, this durability guarantee follows intuitively: once a transaction is
36+
replicated to a quorum, every future quorum will include at least one node
37+
which has applied it. The election process ensures that a node which has not
38+
applied the transaction cannot become the new leader.
39+
40+
## Replicant Retry
41+
42+
The 'replicant\_retry\_on\_not\_durable' tunable causes the replicant servicing
43+
the client request to retry any transaction that has not been replicated to a
44+
quorum. The retry is directed to the current cluster leader, which may change
45+
during course of the request. A non-durable transaction will be retried until
46+
it becomes durable, or until the retry count (controlled by
47+
'survive\_n\_master\_swings') is exhausted.
48+
49+
If retries are exausted, and the 'hide\_non\_durable\_rcode' tunable is set to
50+
true, the client api will return the transaction's original rcode. If set to
51+
false, the client api will return a 402 error (CDB2ERR\_NOTDURABLE).
52+
53+
## Metrics
54+
55+
The leader keeps track of the total number of distributed commits as
56+
'distributed\_commits' in the comdb2\_metrics table. It also tracks the
57+
number of distributed commits that were not durable as 'not\_durable\_commits'.
58+
These metrics are collected regardless of whether durable-LSNs or the
59+
'replicant\_retry\_on\_not\_durable' tunable is enabled.
60+

0 commit comments

Comments
 (0)