diff options
author | Misha Tyulenev <misha@mongodb.com> | 2017-07-11 12:46:24 -0400 |
---|---|---|
committer | Misha Tyulenev <misha@mongodb.com> | 2017-07-11 12:47:24 -0400 |
commit | 42a1339774964f645a3991c3629aa655ffb05cf2 (patch) | |
tree | 219ff15c39190d2aa734ea0cafb4b25d41b4e648 /jstests/sharding | |
parent | 2ed5ff7d34959ebe204697ff615d24a8eabc45bf (diff) | |
download | mongo-42a1339774964f645a3991c3629aa655ffb05cf2.tar.gz |
SERVER-30038 rename $logicalTime to $clusterTime
Diffstat (limited to 'jstests/sharding')
-rw-r--r-- | jstests/sharding/advance_logical_time_with_valid_signature.js | 16 | ||||
-rw-r--r-- | jstests/sharding/causal_consistency_shell_support.js | 8 | ||||
-rw-r--r-- | jstests/sharding/key_rotation.js | 24 | ||||
-rw-r--r-- | jstests/sharding/logical_time_api.js | 12 | ||||
-rw-r--r-- | jstests/sharding/logical_time_metadata.js | 14 | ||||
-rw-r--r-- | jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js | 24 |
6 files changed, 49 insertions, 49 deletions
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. |