[SERVER-18764] Only use elapsedMillis when command succeeds Created: 01/Jun/15  Updated: 25/Jan/17  Resolved: 04/Jun/15

Status: Closed
Project: Core Server
Component/s: Internal Code, Replication
Affects Version/s: 3.1.3
Fix Version/s: 3.1.4

Type: Bug Priority: Major - P3
Reporter: Adam Midvidy Assignee: Siyuan Zhou
Resolution: Done Votes: 0
Labels: UT
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-18007 StatusWith should work with non-defau... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Status responseStatus = cbData.response.getStatus();
... lots of logic ..
if (responseStatus.isOK()) {
.... stuff ...
}
else {
...
networkTime = cbData.response.getValue().elapsedMilis;
...
}

According to mattd@10gen.com, the implementation of the ReplicationCoordinatorImpl relies on the ability to retrieve the elapsedTimeMillis field of a RemoteCommandResponse even if the command failed. In that case the layout of RemoteCommandResponse could potentially be changed to:

struct RemoteCommandResponse {
StatusWith<BSONObj> data;
Milliseconds elapsedMillis;
}

or elapsedMillis could be stored directly in the RemoteCommandCallbackData instead.



 Comments   
Comment by Githook User [ 04/Jun/15 ]

Author:

{u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}

Message: SERVER-18764 Only use elapsedMillis when command succeeds
Branch: master
https://github.com/mongodb/mongo/commit/dd7c8316e870418efb2ceda8b9c490d7e92e47ee

Comment by Scott Hernandez (Inactive) [ 03/Jun/15 ]

As noted, this code can be changed to remove the section reading the invalid data, without further changes:

            if (isUnauthorized) {
                networkTime = cbData.response.getValue().elapsedMillis;
            }

And if a case comes up where we need the error and network round-trip time we can re-address adding that to the RemoteCommandResponse.

Comment by Andy Schwerin [ 01/Jun/15 ]

I like the idea of changing RemoteCommandResponse to contain a StatusWith<BSONObj> and a Milliseconds field.

Comment by Adam Midvidy [ 01/Jun/15 ]

For details: see this failing build of SERVER-18007 https://evergreen.mongodb.com/task/mongodb_mongo_master_linux_64_replicasets_6f3fc07e0a9c0bbb8543ec7618debe862a40b3b2_15_05_29_21_49_07

Generated at Thu Feb 08 03:48:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.