diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/sharding/logical_time_metadata.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/sharding/logical_time_metadata.js')
-rw-r--r-- | jstests/sharding/logical_time_metadata.js | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/jstests/sharding/logical_time_metadata.js b/jstests/sharding/logical_time_metadata.js index e8afac2f5b3..838b3d07816 100644 --- a/jstests/sharding/logical_time_metadata.js +++ b/jstests/sharding/logical_time_metadata.js @@ -4,58 +4,57 @@ * where the cluster time metadata can propagated, making it inherently racy. */ (function() { - "use strict"; +"use strict"; - function assertHasClusterTimeAndOperationTime(res) { - assert.hasFields(res, ['$clusterTime']); - assert.hasFields(res.$clusterTime, ['clusterTime', 'signature']); - } +function assertHasClusterTimeAndOperationTime(res) { + assert.hasFields(res, ['$clusterTime']); + assert.hasFields(res.$clusterTime, ['clusterTime', 'signature']); +} - var st = new ShardingTest({shards: {rs0: {nodes: 3}}}); - st.s.adminCommand({enableSharding: 'test'}); +var st = new ShardingTest({shards: {rs0: {nodes: 3}}}); +st.s.adminCommand({enableSharding: 'test'}); - var db = st.s.getDB('test'); +var db = st.s.getDB('test'); - var res = db.runCommand({insert: 'user', documents: [{x: 10}]}); - assert.commandWorked(res); - assertHasClusterTimeAndOperationTime(res); +var res = db.runCommand({insert: 'user', documents: [{x: 10}]}); +assert.commandWorked(res); +assertHasClusterTimeAndOperationTime(res); - res = db.runCommand({blah: 'blah'}); - assert.commandFailed(res); - assertHasClusterTimeAndOperationTime(res); +res = db.runCommand({blah: 'blah'}); +assert.commandFailed(res); +assertHasClusterTimeAndOperationTime(res); - res = db.runCommand({insert: "user", documents: [{x: 10}], writeConcern: {blah: "blah"}}); - assert.commandFailed(res); - assertHasClusterTimeAndOperationTime(res); +res = db.runCommand({insert: "user", documents: [{x: 10}], writeConcern: {blah: "blah"}}); +assert.commandFailed(res); +assertHasClusterTimeAndOperationTime(res); - res = st.rs0.getPrimary().adminCommand({replSetGetStatus: 1}); +res = st.rs0.getPrimary().adminCommand({replSetGetStatus: 1}); - // Cluster time may advance after replSetGetStatus finishes executing and before its logical - // time metadata is computed, in which case the response's $clusterTime will be greater than the - // appliedOpTime timestamp in its body. Assert the timestamp is <= $clusterTime to account for - // this. - var appliedTime = res.optimes.appliedOpTime.ts; - var logicalTimeMetadata = res.$clusterTime; - assert.lte(0, - timestampCmp(appliedTime, logicalTimeMetadata.clusterTime), - 'appliedTime: ' + tojson(appliedTime) + ' not less than or equal to clusterTime: ' + - tojson(logicalTimeMetadata.clusterTime)); +// Cluster time may advance after replSetGetStatus finishes executing and before its logical +// time metadata is computed, in which case the response's $clusterTime will be greater than the +// appliedOpTime timestamp in its body. Assert the timestamp is <= $clusterTime to account for +// this. +var appliedTime = res.optimes.appliedOpTime.ts; +var logicalTimeMetadata = res.$clusterTime; +assert.lte(0, + timestampCmp(appliedTime, logicalTimeMetadata.clusterTime), + 'appliedTime: ' + tojson(appliedTime) + ' not less than or equal to clusterTime: ' + + tojson(logicalTimeMetadata.clusterTime)); - assert.commandWorked(db.runCommand({ping: 1, '$clusterTime': logicalTimeMetadata})); +assert.commandWorked(db.runCommand({ping: 1, '$clusterTime': logicalTimeMetadata})); - db = st.rs0.getPrimary().getDB('testRS'); - res = db.runCommand({insert: 'user', documents: [{x: 10}]}); - assert.commandWorked(res); - assertHasClusterTimeAndOperationTime(res); +db = st.rs0.getPrimary().getDB('testRS'); +res = db.runCommand({insert: 'user', documents: [{x: 10}]}); +assert.commandWorked(res); +assertHasClusterTimeAndOperationTime(res); - res = db.runCommand({blah: 'blah'}); - assert.commandFailed(res); - assertHasClusterTimeAndOperationTime(res); +res = db.runCommand({blah: 'blah'}); +assert.commandFailed(res); +assertHasClusterTimeAndOperationTime(res); - res = db.runCommand({insert: "user", documents: [{x: 10}], writeConcern: {blah: "blah"}}); - assert.commandFailed(res); - assertHasClusterTimeAndOperationTime(res); - - st.stop(); +res = db.runCommand({insert: "user", documents: [{x: 10}], writeConcern: {blah: "blah"}}); +assert.commandFailed(res); +assertHasClusterTimeAndOperationTime(res); +st.stop(); })(); |