diff options
author | Justin Seyster <justin.seyster@mongodb.com> | 2017-09-14 12:14:54 -0400 |
---|---|---|
committer | Justin Seyster <justin.seyster@mongodb.com> | 2017-09-14 12:14:54 -0400 |
commit | 390e5f47f00dcf133f361e3f9027e4da7d08d628 (patch) | |
tree | 901690cdc5bc1b681e1e2b95c30061784a15187e /src/mongo/db/auth/role_graph_update.cpp | |
parent | 5767ee2421fa6c7934a90e9083f07743a83dcf71 (diff) | |
download | mongo-390e5f47f00dcf133f361e3f9027e4da7d08d628.tar.gz |
SERVER-30705 Add $v field for update semantics in oplog updates.
With the new UpdateNodes class hierarchy, there are two code paths for
applying an update to a document that have slightly different
semantics. The order of fields in the resulting document can vary
depending on which code path is used to apply an update. A difference
in ordering between documents in a replica set is considered a
"mismatch," so we need to ensure that secondaries always apply updates
using the same update system that the primary uses.
When an update executes as part of the application of an oplog entry,
the update is now allowed to have a $v field, which allows it to
specify which semantics were used by the operation that we are
replicating by applying the entry. When the primary uses the new
semantics (because it is a 3.6 mongod with featureCompatibilityVersion
set to 3.6), it includes {$v: 1} in the oplog's update document to
indicate that the secondary should apply with the newer 'UpdateNode'
semantics.
There are two other places where we need this behavior:
1) In role_graph_update.cpp, where the handleOplogUpdate observer
needs to update its in-memory BSON representation of a role to
reflect an update in the admin database and
2) in the applyOps command, which is used for testing how oplog
entries get applied.
Both these code paths set the fromOplogApplication flag, which
replaces the old fromReplication flag, and they also gain behavior
that used to be exclusive to oplog applications from
replication. (Specifically, they skip update validation checks, which
should have already passed before the oplog entry was created.)
Diffstat (limited to 'src/mongo/db/auth/role_graph_update.cpp')
-rw-r--r-- | src/mongo/db/auth/role_graph_update.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mongo/db/auth/role_graph_update.cpp b/src/mongo/db/auth/role_graph_update.cpp index 692529feb5c..9b5629cd3ab 100644 --- a/src/mongo/db/auth/role_graph_update.cpp +++ b/src/mongo/db/auth/role_graph_update.cpp @@ -203,6 +203,7 @@ Status handleOplogUpdate(OperationContext* opCtx, return status; UpdateDriver::Options updateOptions; + updateOptions.modOptions.fromOplogApplication = true; UpdateDriver driver(updateOptions); // Oplog updates do not have array filters. |