As I went through the MongoDB source code and the paper: Implementation of Cluster-wide Logical Clock and Causal Consistency in MongoDB. I have a question about the clock time: Does MongoDB advance the clock time when sending a query with ClusterTime field. For instance, in Change Streams, MongoS build several cursors to each MongoD, then it will send a getMore query to MongoD, so I want to know whether it’’ advance the HLC.
As the above paper said:
- Cluster nodes (mongod, mongos, config server, clients) always track and include the greatest known ClusterTime when sending a message.
- The ClusterTime is incremented (“ticks”) only when there is a write to a primary node’s replication operation log (oplog).
It looks like these two rules are contradictory.