diff options
Diffstat (limited to 'jstests')
15 files changed, 93 insertions, 93 deletions
diff --git a/jstests/core/list_databases.js b/jstests/core/list_databases.js index 80df62f2d1d..8ea7fbfe255 100644 --- a/jstests/core/list_databases.js +++ b/jstests/core/list_databases.js @@ -18,7 +18,7 @@ function verifyNameOnly(listDatabasesOut) { for (let field in listDatabasesOut) { - assert(['databases', 'nameOnly', 'ok', 'operationTime', '$logicalTime'].some((f) => f == + assert(['databases', 'nameOnly', 'ok', 'operationTime', '$clusterTime'].some((f) => f == field), 'unexpected field ' + field); } diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js index 0d46a43c2a4..ed8d3eb8747 100644 --- a/jstests/core/views/views_all_commands.js +++ b/jstests/core/views/views_all_commands.js @@ -318,7 +318,7 @@ ok: 1 }; delete res.operationTime; - delete res.$logicalTime; + delete res.$clusterTime; assert.eq(expectedRes, res, "unexpected result for: " + tojson(killCursorsCmd)); } }, diff --git a/jstests/multiVersion/causal_consistency_downgrade_cluster.js b/jstests/multiVersion/causal_consistency_downgrade_cluster.js index f173a30cf7a..dc623b4af6b 100644 --- a/jstests/multiVersion/causal_consistency_downgrade_cluster.js +++ b/jstests/multiVersion/causal_consistency_downgrade_cluster.js @@ -35,7 +35,7 @@ st.s.getDB("test").runCommand({insert: "foo", documents: [{_id: 1, x: 1}]}); - // Both logical and operation times are returned, and logical times are signed by mongos. Mongos + // Both logical and operation times are returned, and cluster times are signed by mongos. Mongos // doesn't wait for keys at startup, so retry. assert.soonNoExcept(function() { assertContainsLogicalAndOperationTime(st.s.getDB("test").runCommand({isMaster: 1}), @@ -51,7 +51,7 @@ // Change featureCompatibilityVersion to 3.4. assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: "3.4"})); - // Mongos still signs logical times, because they are held in memory. + // Mongos still signs cluster times, because they are held in memory. assertContainsLogicalAndOperationTime(st.s.getDB("test").runCommand({isMaster: 1}), {initialized: true, signed: true}); @@ -73,7 +73,7 @@ st.upgradeCluster("last-stable", {upgradeConfigs: false, upgradeShards: false}); st.restartMongoses(); - // Mongos should no longer return operation or logical times. + // Mongos should no longer return operation or cluster times. assertDoesNotContainLogicalOrOperationTime(st.s.getDB("test").runCommand({isMaster: 1})); // Downgrade shards next. diff --git a/jstests/multiVersion/causal_consistency_upgrade_cluster.js b/jstests/multiVersion/causal_consistency_upgrade_cluster.js index 916684ea29a..ef9d5193d64 100644 --- a/jstests/multiVersion/causal_consistency_upgrade_cluster.js +++ b/jstests/multiVersion/causal_consistency_upgrade_cluster.js @@ -1,6 +1,6 @@ /** * Tests upgrading a cluster with two shards and two mongos servers from last stable to current - * version, verifying the behavior of $logicalTime metadata and afterClusterTime commands throughout + * version, verifying the behavior of $clusterTime metadata and afterClusterTime commands throughout * the process. */ (function() { @@ -96,7 +96,7 @@ assertAfterClusterTimeReadFails(st.rs0.getPrimary().getDB("test"), "foo"); assertAfterClusterTimeReadFails(st.rs1.getPrimary().getDB("test"), "foo"); - // Neither mongos returns logical time or operation time, because there are no keys in the + // Neither mongos returns cluster time or operation time, because there are no keys in the // config server, since feature compatibility version is still 3.4. assertDoesNotContainLogicalOrOperationTime(st.s0.getDB("test").runCommand({isMaster: 1})); assertDoesNotContainLogicalOrOperationTime(st.s1.getDB("test").runCommand({isMaster: 1})); @@ -112,7 +112,7 @@ // Set feature compatibility version to 3.6 on one mongos. assert.commandWorked(st.s0.getDB("admin").runCommand({setFeatureCompatibilityVersion: "3.6"})); - // Now shards and config servers return dummy signed logical times and operation times. + // Now shards and config servers return dummy signed cluster times and operation times. assertContainsLogicalAndOperationTime( st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}), {initialized: true, signed: false}); @@ -124,7 +124,7 @@ {initialized: true, signed: false}); // Once the config primary creates keys, both mongos servers discover them and start returning - // signed logical times. + // signed cluster times. assert.soonNoExcept(function() { assertContainsLogicalAndOperationTime(st.s0.getDB("test").runCommand({isMaster: 1}), {initialized: true, signed: true}); diff --git a/jstests/multiVersion/libs/causal_consistency_helpers.js b/jstests/multiVersion/libs/causal_consistency_helpers.js index 2f3734be0ee..943e59d5d97 100644 --- a/jstests/multiVersion/libs/causal_consistency_helpers.js +++ b/jstests/multiVersion/libs/causal_consistency_helpers.js @@ -20,7 +20,7 @@ function assertDoesNotContainLogicalOrOperationTime(res) { } function assertDoesNotContainLogicalTime(res) { - assert.eq(res.$logicalTime, undefined); + assert.eq(res.$clusterTime, undefined); } function assertDoesNotContainOperationTime(res) { @@ -33,25 +33,25 @@ function assertContainsLogicalAndOperationTime(res, opts) { } function assertContainsLogicalTime(res, opts) { - assert.hasFields(res, ["$logicalTime"]); - assert.hasFields(res.$logicalTime, ["clusterTime", "signature"]); - assert.hasFields(res.$logicalTime.signature, ["hash", "keyId"]); + assert.hasFields(res, ["$clusterTime"]); + assert.hasFields(res.$clusterTime, ["clusterTime", "signature"]); + assert.hasFields(res.$clusterTime.signature, ["hash", "keyId"]); if (opts.signed !== undefined) { - // Signed logical times have a keyId greater than 0. + // Signed cluster times have a keyId greater than 0. if (opts.signed) { - assert(res.$logicalTime.signature.keyId > NumberLong(0)); + assert(res.$clusterTime.signature.keyId > NumberLong(0)); } else { - assert.eq(res.$logicalTime.signature.keyId, NumberLong(0)); + assert.eq(res.$clusterTime.signature.keyId, NumberLong(0)); } } if (opts.initialized !== undefined) { // Initialized operation times are greater than a null timestamp. if (opts.initialized) { - assert.eq(bsonWoCompare(res.$logicalTime.clusterTime, Timestamp(0, 0)), 1); + assert.eq(bsonWoCompare(res.$clusterTime.clusterTime, Timestamp(0, 0)), 1); } else { - assert.eq(bsonWoCompare(res.$logicalTime.clusterTime, Timestamp(0, 0)), 0); + assert.eq(bsonWoCompare(res.$clusterTime.clusterTime, Timestamp(0, 0)), 0); } } } diff --git a/jstests/noPassthrough/auth_reject_mismatching_logical_times.js b/jstests/noPassthrough/auth_reject_mismatching_logical_times.js index 3de5f3f440c..56c2695bdd8 100644 --- a/jstests/noPassthrough/auth_reject_mismatching_logical_times.js +++ b/jstests/noPassthrough/auth_reject_mismatching_logical_times.js @@ -1,31 +1,31 @@ /** - * Verifies mismatching logical time objects are rejected by a sharded cluster when auth is on. In + * Verifies mismatching cluster time objects are rejected by a sharded cluster when auth is on. In * noPassthrough because auth is manually set. */ (function() { "use strict"; - // Given a valid logical time object, returns one with the same signature, but a mismatching + // Given a valid cluster time object, returns one with the same signature, but a mismatching // cluster time. function mismatchingLogicalTime(lt) { return Object.merge(lt, {clusterTime: Timestamp(lt.clusterTime.getTime() + 100, 0)}); } function assertRejectsMismatchingLogicalTime(db) { - let validTime = db.runCommand({isMaster: 1}).$logicalTime; + let validTime = db.runCommand({isMaster: 1}).$clusterTime; let mismatchingTime = mismatchingLogicalTime(validTime); assert.commandFailedWithCode( - db.runCommand({isMaster: 1, $logicalTime: mismatchingTime}), + db.runCommand({isMaster: 1, $clusterTime: mismatchingTime}), ErrorCodes.TimeProofMismatch, - "expected command with mismatching logical time and signature to be rejected"); + "expected command with mismatching cluster time and signature to be rejected"); } function assertAcceptsValidLogicalTime(db) { - let validTime = db.runCommand({isMaster: 1}).$logicalTime; + let validTime = db.runCommand({isMaster: 1}).$clusterTime; assert.commandWorked( - testDB.runCommand({isMaster: 1, $logicalTime: validTime}), - "expected command with valid logical time and signature to be accepted"); + testDB.runCommand({isMaster: 1, $clusterTime: validTime}), + "expected command with valid cluster time and signature to be accepted"); } // Start the sharding test with auth on. @@ -48,7 +48,7 @@ const testDB = st.s.getDB("test"); - // Unsharded collections reject mismatching logical times and accept valid ones. + // Unsharded collections reject mismatching cluster times and accept valid ones. assertRejectsMismatchingLogicalTime(testDB); assertAcceptsValidLogicalTime(testDB); @@ -57,7 +57,7 @@ assert.commandWorked( testDB.adminCommand({shardCollection: testDB.foo.getFullName(), key: {_id: 1}})); - // Sharded collections reject mismatching logical times and accept valid ones. + // Sharded collections reject mismatching cluster times and accept valid ones. assertRejectsMismatchingLogicalTime(testDB); assertAcceptsValidLogicalTime(testDB); diff --git a/jstests/noPassthrough/causal_consistency_feature_compatibility.js b/jstests/noPassthrough/causal_consistency_feature_compatibility.js index fc5075a3d49..6ec8632975f 100644 --- a/jstests/noPassthrough/causal_consistency_feature_compatibility.js +++ b/jstests/noPassthrough/causal_consistency_feature_compatibility.js @@ -10,7 +10,7 @@ function logicalTimeCanBeProcessed(db) { const increment = 5000; - let initialTime = db.runCommand({isMaster: 1}).$logicalTime; + let initialTime = db.runCommand({isMaster: 1}).$clusterTime; if (!initialTime) { return false; } @@ -20,8 +20,8 @@ {clusterTime: Timestamp(initialTime.clusterTime.getTime() + increment, 0)}); let returnedTime = rst.getPrimary() .getDB("test") - .runCommand({isMaster: 1, $logicalTime: laterTime}) - .$logicalTime; + .runCommand({isMaster: 1, $clusterTime: laterTime}) + .$clusterTime; // Use a range to allow for unrelated activity advancing cluster time. return (returnedTime.clusterTime.getTime() - initialTime.clusterTime.getTime()) >= @@ -64,14 +64,14 @@ assert.commandWorked(rst.getPrimary().getDB("test").runCommand( {find: "foo", readConcern: {level: "majority", afterClusterTime: Timestamp(1, 1)}})); - // Verify logical time can be processed by shards and the config servers. + // Verify cluster time can be processed by shards and the config servers. assert(logicalTimeCanBeProcessed(rst.getPrimary().getDB("test"))); assert(logicalTimeCanBeProcessed(st.configRS.getPrimary().getDB("test"))); // Set featureCompatibilityVersion to 3.4 assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: "3.4"})); - // Verify logical time cannot be processed by shards and the config servers now. + // Verify cluster time cannot be processed by shards and the config servers now. assert(!logicalTimeCanBeProcessed(rst.getPrimary().getDB("test"))); assert(!logicalTimeCanBeProcessed(st.configRS.getPrimary().getDB("test"))); @@ -89,7 +89,7 @@ // setFeatureCompatibilityVersion can only be run on the admin database on mongos. assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: "3.6"})); - // Verify logical time can be processed by shards and the config servers again. + // Verify cluster time can be processed by shards and the config servers again. assert(logicalTimeCanBeProcessed(rst.getPrimary().getDB("test"))); assert(logicalTimeCanBeProcessed(st.configRS.getPrimary().getDB("test"))); diff --git a/jstests/noPassthrough/max_acceptable_logical_clock_drift_secs_parameter.js b/jstests/noPassthrough/max_acceptable_logical_clock_drift_secs_parameter.js index 5406dfa501e..2a3c07186a6 100644 --- a/jstests/noPassthrough/max_acceptable_logical_clock_drift_secs_parameter.js +++ b/jstests/noPassthrough/max_acceptable_logical_clock_drift_secs_parameter.js @@ -1,6 +1,6 @@ /** * Tests what values are accepted for the maxAcceptableLogicalClockDriftSecs startup parameter, and - * that servers in a sharded clusters reject logical times more than + * that servers in a sharded clusters reject cluster times more than * maxAcceptableLogicalClockDriftSecs ahead of their wall clocks. */ (function() { @@ -43,15 +43,15 @@ }); let testDB = st.s.getDB("test"); - // Contact cluster to get initial logical time. + // Contact cluster to get initial cluster time. let res = assert.commandWorked(testDB.runCommand({isMaster: 1})); - let lt = res.$logicalTime; + let lt = res.$clusterTime; - // Try to advance logical time by more than the max acceptable drift, which should fail the rate + // Try to advance cluster time by more than the max acceptable drift, which should fail the rate // limiter. let tooFarTime = Object.assign( lt, {clusterTime: new Timestamp(lt.clusterTime.getTime() + (maxDriftValue * 2), 0)}); - assert.commandFailedWithCode(testDB.runCommand({isMaster: 1, $logicalTime: tooFarTime}), + assert.commandFailedWithCode(testDB.runCommand({isMaster: 1, $clusterTime: tooFarTime}), ErrorCodes.ClusterTimeFailsRateLimiter, "expected command to not pass the rate limiter"); diff --git a/jstests/replsets/operation_time_read_and_write_concern.js b/jstests/replsets/operation_time_read_and_write_concern.js index e5a6faba1ce..ebe3b186bf9 100644 --- a/jstests/replsets/operation_time_read_and_write_concern.js +++ b/jstests/replsets/operation_time_read_and_write_concern.js @@ -24,7 +24,7 @@ var collectionName = "foo"; // readConcern level majority: - // operationTime is the logical time of the last committed op in the oplog. + // operationTime is the cluster time of the last committed op in the oplog. jsTestLog("Testing operationTime for readConcern level majority with afterClusterTime."); var majorityDoc = {_id: 10, x: 1}; var localDoc = {_id: 15, x: 2}; @@ -55,7 +55,7 @@ assert.eq(majorityReadOperationTime, majorityWriteOperationTime, "the operationTime of the majority read, " + majorityReadOperationTime + - ", should be the logical time of the last committed op in the oplog, " + + ", should be the cluster time of the last committed op in the oplog, " + majorityWriteOperationTime); // Validate that after replication, the local write data is now returned by the same query. @@ -77,7 +77,7 @@ assert.eq(secondMajorityReadOperationTime, localWriteOperationTime, "the operationTime of the second majority read, " + secondMajorityReadOperationTime + - ", should be the logical time of the replicated local write, " + + ", should be the cluster time of the replicated local write, " + localWriteOperationTime); // readConcern level linearizable is not currently supported. @@ -92,7 +92,7 @@ "linearizable reads with afterClusterTime are not supported and should not be allowed"); // writeConcern level majority: - // operationTime is the logical time of the write if it succeeds, or of the previous successful + // operationTime is the cluster time of the write if it succeeds, or of the previous successful // write at the time the write was determined to have failed, or a no-op. jsTestLog("Testing operationTime for writeConcern level majority."); var successfulDoc = {_id: 1000, y: 1}; @@ -113,7 +113,7 @@ failedWriteOperationTime, majorityWriteOperationTime, "the operationTime of the failed majority write, " + failedWriteOperationTime + - ", should be the logical time of the last successful write at the time it failed, " + + ", should be the cluster time of the last successful write at the time it failed, " + majorityWriteOperationTime); replTest.stopSet(); diff --git a/jstests/sharding/advance_logical_time_with_valid_signature.js b/jstests/sharding/advance_logical_time_with_valid_signature.js index e2a379d981f..ef2f5e44e81 100644 --- a/jstests/sharding/advance_logical_time_with_valid_signature.js +++ b/jstests/sharding/advance_logical_time_with_valid_signature.js @@ -1,5 +1,5 @@ /** - * Tests that the mongo shell can use a logical time with a valid signature to advance a server's + * Tests that the mongo shell can use a cluster time with a valid signature to advance a server's * cluster time. */ (function() { @@ -26,16 +26,16 @@ // Get logicalTime metadata from the connected mongos's response and send it in an isMaster // command to the disconnected mongos. isMaster does not require mongos to contact any other // servers, so the command should succeed. - let lt = res.$logicalTime; + let lt = res.$clusterTime; res = assert.commandWorked( - disconnectedDB.runCommand({isMaster: 1, $logicalTime: lt}), - "expected the disconnected mongos to accept logical time: " + tojson(lt)); + disconnectedDB.runCommand({isMaster: 1, $clusterTime: lt}), + "expected the disconnected mongos to accept cluster time: " + tojson(lt)); - // Verify logical time response from the disconnected mongos matches what was passed. + // Verify cluster time response from the disconnected mongos matches what was passed. assert.eq(lt, - res.$logicalTime, - "expected the disconnected mongos to send logical time: " + tojson(lt) + - ", received: " + tojson(res.$logicalTime)); + res.$clusterTime, + "expected the disconnected mongos to send cluster time: " + tojson(lt) + + ", received: " + tojson(res.$clusterTime)); st.stop(); })(); diff --git a/jstests/sharding/causal_consistency_shell_support.js b/jstests/sharding/causal_consistency_shell_support.js index b3a84fc9d96..4a75bc8c2d7 100644 --- a/jstests/sharding/causal_consistency_shell_support.js +++ b/jstests/sharding/causal_consistency_shell_support.js @@ -53,7 +53,7 @@ function commandReturnsExpectedResult(cmdObj, db, resCallback) { const mongo = db.getMongo(); - // Use the latest logical time returned as a new operationTime and run command. + // Use the latest cluster time returned as a new operationTime and run command. const clusterTimeObj = mongo.getClusterTime(); mongo.setOperationTime(clusterTimeObj.clusterTime); const res = assert.commandWorked(testDB.runCommand(cmdObj)); @@ -136,8 +136,8 @@ checkCausalConsistencySupportForCommandNames(supportedCommandNames, false); checkCausalConsistencySupportForCommandNames(unsupportedCommandNames, false); - // Verify logical times are tracked even before causal consistency is set (so the first - // operation with causal consistency set can use valid logical times). + // Verify cluster times are tracked even before causal consistency is set (so the first + // operation with causal consistency set can use valid cluster times). mongo._operationTime = null; mongo._clusterTime = null; @@ -157,7 +157,7 @@ runCommandAndCheckLogicalTimes( {update: "foo", updates: [{q: {x: 2}, u: {$set: {x: 3}}}]}, testDB, true); - // Test that each supported command works as expected and the shell's logical times are properly + // Test that each supported command works as expected and the shell's cluster times are properly // forwarded to the server and updated based on the response. mongo.setCausalConsistency(true); diff --git a/jstests/sharding/key_rotation.js b/jstests/sharding/key_rotation.js index a825a249d1a..ee642c7f059 100644 --- a/jstests/sharding/key_rotation.js +++ b/jstests/sharding/key_rotation.js @@ -1,7 +1,7 @@ /** * Tests for causal consistency key rotation. In particular, tests: * - that a sharded cluster with no keys inserts new keys after startup. - * - responses from servers in a sharded cluster contain a logical time object with a signature. + * - responses from servers in a sharded cluster contain a cluster time object with a signature. * - manual key rotation is possible by deleting existing keys and restarting the cluster. * * Manual key rotation requires restarting a shard, so a persistent storage engine is necessary. @@ -24,13 +24,13 @@ "key document " + i + ": " + tojson(key) + ", did not have all of the expected fields"); }); - // Verify there is a $logicalTime with a signature in the response. - jsTestLog("Verify a signature is included in the logical time in a response."); + // Verify there is a $clusterTime with a signature in the response. + jsTestLog("Verify a signature is included in the cluster time in a response."); let res = assert.commandWorked(st.s.getDB("test").runCommand({isMaster: 1})); - assert.hasFields(res, ["$logicalTime"]); - assert.hasFields(res.$logicalTime, ["signature"]); - assert.hasFields(res.$logicalTime.signature, ["hash", "keyId"]); + assert.hasFields(res, ["$clusterTime"]); + assert.hasFields(res.$clusterTime, ["signature"]); + assert.hasFields(res.$clusterTime.signature, ["hash", "keyId"]); // Verify manual key rotation. jsTestLog("Verify manual key rotation."); @@ -64,16 +64,16 @@ st.rs0.startSet({restart: true}); st.restartMongos(0); - // The shard primary should return a dummy signed logical time, because there are no keys. + // The shard primary should return a dummy signed cluster time, because there are no keys. res = assert.commandWorked(st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1})); - assert.hasFields(res, ["$logicalTime", "operationTime"]); - assert.eq(res.$logicalTime.signature.keyId, NumberLong(0)); + assert.hasFields(res, ["$clusterTime", "operationTime"]); + assert.eq(res.$clusterTime.signature.keyId, NumberLong(0)); - // Mongos shouldn't return a logical time at all. + // Mongos shouldn't return a cluster time at all. res = assert.commandWorked(st.s.getDB("test").runCommand({isMaster: 1})); assert.throws(function() { - assert.hasFields(res, ["$logicalTime", "operationTime"]); - }, [], "expected the mongos not to return logical time or operation time"); + assert.hasFields(res, ["$clusterTime", "operationTime"]); + }, [], "expected the mongos not to return cluster time or operation time"); // Resume key generation. for (let i = 0; i < st.configRS.nodes.length; i++) { diff --git a/jstests/sharding/logical_time_api.js b/jstests/sharding/logical_time_api.js index 61fcb5b9d14..77df002f2bf 100644 --- a/jstests/sharding/logical_time_api.js +++ b/jstests/sharding/logical_time_api.js @@ -11,7 +11,7 @@ "use strict"; // Returns true if the given object contains a logicalTime BSON object in the following format: - // $logicalTime: { + // $clusterTime: { // clusterTime: <Timestamp> // signature: { // hash: <BinData> @@ -23,7 +23,7 @@ return false; } - var logicalTime = obj.$logicalTime; + var logicalTime = obj.$clusterTime; return logicalTime && isType(logicalTime, "BSON") && isType(logicalTime.clusterTime, "Timestamp") && isType(logicalTime.signature, "BSON") && isType(logicalTime.signature.hash, "BinData") && @@ -59,8 +59,8 @@ "Expected command body from a mongos talking to a sharded collection on a sharded " + "replica set to contain logicalTime, received: " + tojson(res)); - // Verify mongos can accept requests with $logicalTime in the command body. - assert.commandWorked(testDB.runCommand({isMaster: 1, $logicalTime: res.$logicalTime})); + // Verify mongos can accept requests with $clusterTime in the command body. + assert.commandWorked(testDB.runCommand({isMaster: 1, $clusterTime: res.$clusterTime})); // A mongod in a sharded replica set returns a logicalTime bson that matches the expected // format. @@ -70,8 +70,8 @@ "Expected command body from a mongod in a sharded replica set to contain " + "logicalTime, received: " + tojson(res)); - // Verify mongod can accept requests with $logicalTime in the command body. - res = assert.commandWorked(testDB.runCommand({isMaster: 1, $logicalTime: res.$logicalTime})); + // Verify mongod can accept requests with $clusterTime in the command body. + res = assert.commandWorked(testDB.runCommand({isMaster: 1, $clusterTime: res.$clusterTime})); st.stop(); diff --git a/jstests/sharding/logical_time_metadata.js b/jstests/sharding/logical_time_metadata.js index adf0d397c82..63d3fc57cef 100644 --- a/jstests/sharding/logical_time_metadata.js +++ b/jstests/sharding/logical_time_metadata.js @@ -1,7 +1,7 @@ /** - * Basic test that checks that mongos includes the logical time metatadata in it's response. - * This does not test logical time propagation via the shell as there are many back channels - * where the logical time metadata can propagated, making it inherently racy. + * Basic test that checks that mongos includes the cluster time metatadata in it's response. + * This does not test cluster time propagation via the shell as there are many back channels + * where the cluster time metadata can propagated, making it inherently racy. */ (function() { var st = new ShardingTest({shards: {rs0: {nodes: 3}}, mongosWaitsForKeys: true}); @@ -9,11 +9,11 @@ var db = st.s.getDB('test'); - // insert on one shard and extract the logical time + // insert on one shard and extract the cluster time var res = assert.commandWorked(db.runCommand({insert: 'user', documents: [{x: 10}]})); - assert.hasFields(res, ['$logicalTime']); + assert.hasFields(res, ['$clusterTime']); - var logicalTimeMetadata = res.$logicalTime; + var logicalTimeMetadata = res.$clusterTime; assert.hasFields(logicalTimeMetadata, ['clusterTime', 'signature']); res = st.rs0.getPrimary().adminCommand({replSetGetStatus: 1}); @@ -24,7 +24,7 @@ 'appliedTime: ' + tojson(appliedTime) + ' != clusterTime: ' + tojson(logicalTimeMetadata.clusterTime)); - assert.commandWorked(db.runCommand({ping: 1, '$logicalTime': logicalTimeMetadata})); + assert.commandWorked(db.runCommand({ping: 1, '$clusterTime': logicalTimeMetadata})); st.stop(); diff --git a/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js b/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js index 1ed8d9c6fb1..3549e9c0546 100644 --- a/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js +++ b/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js @@ -1,5 +1,5 @@ /** - * Tests that mongos does not gossip logical time metadata until at least one key is created on the + * Tests that mongos does not gossip cluster time metadata until at least one key is created on the * config server, and that it does not block waiting for keys at startup. */ @@ -10,19 +10,19 @@ load("jstests/multiVersion/libs/multi_cluster.js"); // For restartMongoses. function assertContainsValidLogicalTime(res) { - assert.hasFields(res, ["$logicalTime"]); - assert.hasFields(res.$logicalTime, ["signature", "clusterTime"]); + assert.hasFields(res, ["$clusterTime"]); + assert.hasFields(res.$clusterTime, ["signature", "clusterTime"]); // clusterTime must be greater than the uninitialzed value. - assert.eq(bsonWoCompare(res.$logicalTime.clusterTime, Timestamp(0, 0)), 1); - assert.hasFields(res.$logicalTime.signature, ["hash", "keyId"]); + assert.eq(bsonWoCompare(res.$clusterTime.clusterTime, Timestamp(0, 0)), 1); + assert.hasFields(res.$clusterTime.signature, ["hash", "keyId"]); // The signature must have been signed by a key with a valid generation. - assert(res.$logicalTime.signature.keyId > NumberLong(0)); + assert(res.$clusterTime.signature.keyId > NumberLong(0)); } let st = new ShardingTest({shards: {rs0: {nodes: 2}}}); // Verify there are keys in the config server eventually, since mongos doesn't block for keys at - // startup, and that once there are, mongos sends $logicalTime with a signature in responses. + // startup, and that once there are, mongos sends $clusterTime with a signature in responses. assert.soonNoExcept(function() { assert(st.s.getDB("admin").system.keys.count() >= 2); @@ -30,7 +30,7 @@ assertContainsValidLogicalTime(res); return true; - }, "expected keys to be created and for mongos to send signed logical times"); + }, "expected keys to be created and for mongos to send signed cluster times"); // Enable the failpoint, remove all keys, and restart the config servers with the failpoint // still enabled to guarantee there are no keys. @@ -57,11 +57,11 @@ // Mongos should restart with no problems. st.restartMongoses(); - // There should be no logical time metadata in mongos responses. + // There should be no cluster time metadata in mongos responses. res = assert.commandWorked(st.s.getDB("test").runCommand({isMaster: 1})); assert.throws(function() { assertContainsValidLogicalTime(res); - }, [], "expected mongos to not return logical time metadata"); + }, [], "expected mongos to not return cluster time metadata"); // Disable the failpoint. for (let i = 0; i < st.configRS.nodes.length; i++) { @@ -69,11 +69,11 @@ {"configureFailPoint": "disableKeyGeneration", "mode": "off"})); } - // Eventually mongos will discover the new keys, and start signing logical times. + // Eventually mongos will discover the new keys, and start signing cluster times. assert.soonNoExcept(function() { assertContainsValidLogicalTime(st.s.getDB("test").runCommand({isMaster: 1})); return true; - }, "expected mongos to eventually start signing logical times", 60 * 1000); // 60 seconds. + }, "expected mongos to eventually start signing cluster times", 60 * 1000); // 60 seconds. // There may be a delay between the creation of the first and second keys, but mongos will start // signing after seeing the first key, so there is only guaranteed to be one at this point. |