File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 30
30
31
31
res = st . rs0 . getPrimary ( ) . adminCommand ( { replSetGetStatus : 1 } ) ;
32
32
33
+ // Cluster time may advance after replSetGetStatus finishes executing and before its logical
34
+ // time metadata is computed, in which case the response's $clusterTime will be greater than the
35
+ // appliedOpTime timestamp in its body. Assert the timestamp is <= $clusterTime to account for
36
+ // this.
33
37
var appliedTime = res . optimes . appliedOpTime . ts ;
34
38
var logicalTimeMetadata = res . $clusterTime ;
35
- assert . eq ( 0 ,
36
- timestampCmp ( appliedTime , logicalTimeMetadata . clusterTime ) ,
37
- 'appliedTime: ' + tojson ( appliedTime ) + ' != clusterTime: ' +
38
- tojson ( logicalTimeMetadata . clusterTime ) ) ;
39
+ assert . lte ( 0 ,
40
+ timestampCmp ( appliedTime , logicalTimeMetadata . clusterTime ) ,
41
+ 'appliedTime: ' + tojson ( appliedTime ) + ' not less than or equal to clusterTime: ' +
42
+ tojson ( logicalTimeMetadata . clusterTime ) ) ;
39
43
40
44
assert . commandWorked ( db . runCommand ( { ping : 1 , '$clusterTime' : logicalTimeMetadata } ) ) ;
41
45
You can’t perform that action at this time.
0 commit comments