summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2017-04-18 13:00:19 -0400
committerJack Mulrow <jack.mulrow@mongodb.com>2017-04-19 10:44:36 -0400
commit0763be70eab32bd852a70f44bfdb67046a693df5 (patch)
treecb8fb6c9328ed5ba5881f0cc3f5dba907f70f5a4 /src
parentc776e095ac25d0426624f4a84c03f0094c3c661f (diff)
downloadmongo-0763be70eab32bd852a70f44bfdb67046a693df5.tar.gz
SERVER-28565 invariant for _clusterTime proof in LogicalTimeMetadata::writeToMetadata
Diffstat (limited to 'src')
-rw-r--r--src/mongo/rpc/metadata/logical_time_metadata.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/rpc/metadata/logical_time_metadata.cpp b/src/mongo/rpc/metadata/logical_time_metadata.cpp
index 21f36cc3e26..235fc0d99bb 100644
--- a/src/mongo/rpc/metadata/logical_time_metadata.cpp
+++ b/src/mongo/rpc/metadata/logical_time_metadata.cpp
@@ -105,6 +105,9 @@ void LogicalTimeMetadata::writeToMetadata(BSONObjBuilder* metadataBuilder) const
_clusterTime.getTime().asTimestamp().append(subObjBuilder.bb(), kClusterTimeFieldName);
BSONObjBuilder signatureObjBuilder(subObjBuilder.subobjStart(kSignatureFieldName));
+ // Logical time metadata is only written when LogicalClock::canVerifyAndSign returns true, which
+ // means the cluster time should always have a proof.
+ invariant(_clusterTime.getProof());
_clusterTime.getProof()->appendAsBinData(signatureObjBuilder, kSignatureHashFieldName);
signatureObjBuilder.append(kSignatureKeyIdFieldName, _clusterTime.getKeyId());
signatureObjBuilder.doneFast();