[SERVER-28565] Do not return logicalTime on standalone RS Created: 30/Mar/17  Updated: 06/Dec/17  Resolved: 18/Apr/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.5.7

Type: Bug Priority: Major - P3
Reporter: Misha Tyulenev Assignee: Jack Mulrow
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2017-04-17, Sharding 2017-05-08
Participants:

 Description   

Currently it will return logicalTime signed with default signature instead should not return the signature bson obj at all.

The proposed implementation will construct TimeProofService only when the RS is known to transition to sharding state, so the initial LogicalClock initialization will use a dummy TPS.
This also should include a protection from advancing clusterTime from the metadata, the only source of the clusterTime is an opLog.
This should not affect the operationTime that is generated from the opLog and afterClusterTime that also needs only opLog.

1. make _timeProofService optional and add a methods to reset it.

class LogicalClock:
...
  // remove TPS from c-tor
  LogicalClock(ServiceContext*);
 
  // reset TPS
  void setTimeProofService(std::unique_ptr<TimeProofService>) 
 }

2. set TPS in the initializeGlobalShardingState

3. make TimeProof optional

class SignedLogicalTime {
...
boost::optional<TimeProof> _proof;
}

4. Do not generate _proof if there is not TPS in _makeSignedLogicalTime

5. Non sharded RS will return an error if the command it receives contains logicalTime metadata.
The reason is that drivers should not use same connection when they speak to different mongos. If a shard became unsharded the mongos will not address it anymore. Even if its addressed its shardingState is still active i.e. the shard “does not know” that its removed from the config server. Hence there is no scenario where the client send the logicalTime to a non sharded RS.

Hence Return a BadInput error from advanceClusterTime or advanceClusterTimeFromTrustedSource if there is no TPS.

6. do not include logicalTime in the command response and metadata if there is no TPS

7. testcases - there is SERVER-28451 that should include the testing.



 Comments   
Comment by Githook User [ 19/Apr/17 ]

Author:

{u'username': u'jsmulrow', u'name': u'Jack Mulrow', u'email': u'jack.mulrow@mongodb.com'}

Message: SERVER-28565 invariant for _clusterTime proof in LogicalTimeMetadata::writeToMetadata
Branch: master
https://github.com/mongodb/mongo/commit/0763be70eab32bd852a70f44bfdb67046a693df5

Comment by Githook User [ 18/Apr/17 ]

Author:

{u'username': u'jsmulrow', u'name': u'Jack Mulrow', u'email': u'jack.mulrow@mongodb.com'}

Message: SERVER-28565 Do not return logicalTime on non-sharded RS
Branch: master
https://github.com/mongodb/mongo/commit/36dee9cbf58710f4168d39104aa5d446b3f15d49

Comment by Randolph Tan [ 04/Apr/17 ]

Looks good to me

Comment by Misha Tyulenev [ 04/Apr/17 ]

renctan, jack.mulrow please give feedback

Generated at Thu Feb 08 04:18:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.