summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/read_concern_args.h
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2020-06-11 15:52:54 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-11 20:17:46 +0000
commite485c1a8011d85682cb8dafa87ab92b9c23daa66 (patch)
tree6f81bf10da29be6451f073af361b5f8e94252bc5 /src/mongo/db/repl/read_concern_args.h
parent5c7cdc392c2ea058d7ec93609203fcc5bb74bb99 (diff)
downloadmongo-e485c1a8011d85682cb8dafa87ab92b9c23daa66.tar.gz
Revert "SERVER-47952 Shard selects timestamp for one-shard snapshot find"
This reverts commit 219dadadf97345a4cceab50f04e87b361a749c6c.
Diffstat (limited to 'src/mongo/db/repl/read_concern_args.h')
-rw-r--r--src/mongo/db/repl/read_concern_args.h28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/mongo/db/repl/read_concern_args.h b/src/mongo/db/repl/read_concern_args.h
index 2c7aca60282..ba6004d13bf 100644
--- a/src/mongo/db/repl/read_concern_args.h
+++ b/src/mongo/db/repl/read_concern_args.h
@@ -182,21 +182,13 @@ public:
* Set atClusterTime, clear afterClusterTime. The BSON representation becomes
* {level: "snapshot", atClusterTime: <ts>}.
*/
- void setArgsAtClusterTime(Timestamp ts) {
+ void setArgsAtClusterTimeForSnapshot(Timestamp ts) {
invariant(_level && _level == ReadConcernLevel::kSnapshotReadConcern);
// Only overwrite a server-selected atClusterTime, not user-supplied.
- invariant(!_clientAtClusterTime);
- _computedAfterClusterTime = boost::none;
- _computedAtClusterTime = LogicalTime(ts);
- }
-
- /**
- * If we have selected an atClusterTime for non-transaction snapshot reads, clear it and restore
- * the atClusterTime and afterClusterTime passed by the client.
- */
- void clearArgsAtClusterTime() {
- _computedAfterClusterTime = _clientAfterClusterTime;
- _computedAtClusterTime = _clientAtClusterTime;
+ invariant(_atClusterTime.is_initialized() == _atClusterTimeSelected);
+ _afterClusterTime = boost::none;
+ _atClusterTime = LogicalTime(ts);
+ _atClusterTimeSelected = true;
}
/**
@@ -204,7 +196,7 @@ public:
* function returns false if the atClusterTime was specified by the client.
*/
bool wasAtClusterTimeSelected() const {
- return _computedAtClusterTime && _computedAtClusterTime != _clientAtClusterTime;
+ return _atClusterTimeSelected;
}
private:
@@ -221,13 +213,11 @@ private:
/**
* Read data after cluster-wide cluster time.
*/
- boost::optional<LogicalTime> _clientAfterClusterTime;
- boost::optional<LogicalTime> _computedAfterClusterTime;
+ boost::optional<LogicalTime> _afterClusterTime;
/**
* Read data at a particular cluster time.
*/
- boost::optional<LogicalTime> _clientAtClusterTime;
- boost::optional<LogicalTime> _computedAtClusterTime;
+ boost::optional<LogicalTime> _atClusterTime;
boost::optional<ReadConcernLevel> _level;
/**
@@ -243,6 +233,8 @@ private:
bool _specified;
ReadWriteConcernProvenance _provenance;
+
+ bool _atClusterTimeSelected = false;
};
} // namespace repl