diff options
author | ali-mir <ali.mir@mongodb.com> | 2021-09-14 18:01:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-14 18:31:31 +0000 |
commit | 4e3787d83b0247aef9a9d27e25c00de21065c08f (patch) | |
tree | 6cbb9b3898ad5ce78f50f08d47b805ce45cd8491 /src/mongo/db/repl/README.md | |
parent | c963faf497cd15e36acfb39f1197ee6d42c920e6 (diff) | |
download | mongo-4e3787d83b0247aef9a9d27e25c00de21065c08f.tar.gz |
SERVER-59865 Update repl arch guide to reflect new implicit default write concern formula
Diffstat (limited to 'src/mongo/db/repl/README.md')
-rw-r--r-- | src/mongo/db/repl/README.md | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mongo/db/repl/README.md b/src/mongo/db/repl/README.md index 78fb0b64ce1..c99195b894a 100644 --- a/src/mongo/db/repl/README.md +++ b/src/mongo/db/repl/README.md @@ -76,18 +76,17 @@ known as the implicit default write concern (IDWC). For most cases, the IDWC wil The IDWC is calculated on startup using the **Default Write Concern Formula (DWCF)**: -`implicitDefaultWriteConcern = if [(#arbiters > 0) AND (#arbiters >= ½(#voting nodes) - 1)] then {w:1} else {w:majority}` - -In replica sets with arbiters, there are cases where the set can lose a majority of data-bearing -nodes, but the primary would stay primary due to arbiters' votes. The primary is unable to fulfill -majority writes, as it cannot reach a majority of data-bearing nodes. To prevent the primary from -hanging while trying to acknowledge majority writes, the server will set the implicit default to -`{w: 1}`. - -As an example, if we have a PSA replica set, and the secondary goes down, the primary cannot -successfully acknowledge a majority write. However, the primary will remain primary with the -arbiter's vote. In this case, the DWCF will have preemptively set the IDWC to `{w: 1}` -so the user can still perform writes to the replica set. +`implicitDefaultWriteConcern = if ((#arbiters > 0) AND (#non-arbiters <= majority(#voting nodes)) then {w:1} else {w:majority}` + +This formula specifies that for replica sets with arbiters, we want to ensure that we set the +implicit default to a value that the set can satisfy in the event of one data-bearing node +going down. That is, the number of data-bearing nodes must be strictly greater than the majority +of voting nodes for the set to set `{w: "majority"}`. + +For example, if we have a PSA replica set, and the secondary goes down, the primary cannot +successfully acknowledge a majority write as the majority for the set is two nodes. However, the +primary will remain primary with the arbiter's vote. In this case, the DWCF will have preemptively +set the IDWC to `{w: 1}` so the user can still perform writes to the replica set. #### Implicit Default Write Concern and Sharded Clusters |