summaryrefslogtreecommitdiff
path: root/src/mongo/db/key_generator.cpp
diff options
context:
space:
mode:
authorKevin Pulo <kevin.pulo@mongodb.com>2020-09-15 11:44:54 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-17 04:31:08 +0000
commit686ee776666ebcfa15f3744142f74b6f1d59e617 (patch)
tree4b03cae9999243359291acc931eaae8daa2b5869 /src/mongo/db/key_generator.cpp
parent8213debcbf8b9495c0e336d98a8bf75df7f088c5 (diff)
downloadmongo-686ee776666ebcfa15f3744142f74b6f1d59e617.tar.gz
SERVER-48433 Remove LogicalClock facade
Diffstat (limited to 'src/mongo/db/key_generator.cpp')
-rw-r--r--src/mongo/db/key_generator.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/db/key_generator.cpp b/src/mongo/db/key_generator.cpp
index 7c95d210bfa..3e899fd888b 100644
--- a/src/mongo/db/key_generator.cpp
+++ b/src/mongo/db/key_generator.cpp
@@ -33,8 +33,8 @@
#include "mongo/client/read_preference.h"
#include "mongo/db/keys_collection_client.h"
-#include "mongo/db/logical_clock.h"
#include "mongo/db/operation_context.h"
+#include "mongo/db/vector_clock.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/util/fail_point.h"
@@ -80,8 +80,8 @@ Status KeyGenerator::generateNewKeysIfNeeded(OperationContext* opCtx) {
return {ErrorCodes::FailPointEnabled, "key generation disabled"};
}
- auto currentTime = LogicalClock::get(opCtx)->getClusterTime();
- auto keyStatus = _client->getNewKeys(opCtx, _purpose, currentTime, false);
+ const auto currentTime = VectorClock::get(opCtx)->getTime();
+ auto keyStatus = _client->getNewKeys(opCtx, _purpose, currentTime.clusterTime(), false);
if (!keyStatus.isOK()) {
return keyStatus.getStatus();
@@ -92,10 +92,10 @@ Status KeyGenerator::generateNewKeysIfNeeded(OperationContext* opCtx) {
LogicalTime currentKeyExpiresAt;
- long long keyId = currentTime.asTimestamp().asLL();
+ long long keyId = currentTime.clusterTime().asTimestamp().asLL();
if (keyIter == newKeys.cend()) {
- currentKeyExpiresAt = addSeconds(currentTime, _keyValidForInterval);
+ currentKeyExpiresAt = addSeconds(currentTime.clusterTime(), _keyValidForInterval);
auto status = insertNewKey(opCtx, _client, keyId, _purpose, currentKeyExpiresAt);
if (!status.isOK()) {
@@ -103,8 +103,8 @@ Status KeyGenerator::generateNewKeysIfNeeded(OperationContext* opCtx) {
}
keyId++;
- } else if (keyIter->getExpiresAt() < currentTime) {
- currentKeyExpiresAt = addSeconds(currentTime, _keyValidForInterval);
+ } else if (keyIter->getExpiresAt() < currentTime.clusterTime()) {
+ currentKeyExpiresAt = addSeconds(currentTime.clusterTime(), _keyValidForInterval);
auto status = insertNewKey(opCtx, _client, keyId, _purpose, currentKeyExpiresAt);
if (!status.isOK()) {
@@ -128,7 +128,7 @@ Status KeyGenerator::generateNewKeysIfNeeded(OperationContext* opCtx) {
if (!status.isOK()) {
return status;
}
- } else if (keyIter->getExpiresAt() < currentTime) {
+ } else if (keyIter->getExpiresAt() < currentTime.clusterTime()) {
currentKeyExpiresAt = addSeconds(currentKeyExpiresAt, _keyValidForInterval);
auto status = insertNewKey(opCtx, _client, keyId, _purpose, currentKeyExpiresAt);