summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingzhi Deng <lingzhi.deng@mongodb.com>2021-08-09 11:24:44 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-17 16:07:54 +0000
commit1ddb121d46d2fa14b2ec4c5a151f3f3ff0771a02 (patch)
tree028a8844d6fccd6c15c129835c20ad203cb5c75e
parent7bb37623c2ec55ea6aa66c9653b7be3003547eb7 (diff)
downloadmongo-1ddb121d46d2fa14b2ec4c5a151f3f3ff0771a02.tar.gz
SERVER-58169: Log timestamps info on hitting invariants around stable timestamp calculation
(cherry picked from commit 9c13c4f4fc60066b326146f9b52a28ea8ad5d164)
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 837f142d5e9..9c61b67b0dc 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -3744,7 +3744,10 @@ boost::optional<OpTimeAndWallTime> ReplicationCoordinatorImpl::_chooseStableOpTi
// There is a valid stable optime.
else {
auto stableOpTime = *std::prev(upperBoundIter);
- invariant(stableOpTime.opTime.getTimestamp() <= maximumStableTimestamp);
+ invariant(stableOpTime.opTime.getTimestamp() <= maximumStableTimestamp,
+ str::stream() << "stableOpTime: " << stableOpTime.opTime.toString()
+ << " maximumStableTimestamp: "
+ << maximumStableTimestamp.toString());
return stableOpTime;
}
}
@@ -3787,8 +3790,12 @@ boost::optional<OpTimeAndWallTime> ReplicationCoordinatorImpl::_recalculateStabl
auto commitPoint = _topCoord->getLastCommittedOpTimeAndWallTime();
if (_currentCommittedSnapshot) {
auto snapshotOpTime = _currentCommittedSnapshot->opTime;
- invariant(snapshotOpTime.getTimestamp() <= commitPoint.opTime.getTimestamp());
- invariant(snapshotOpTime <= commitPoint.opTime);
+ invariant(snapshotOpTime.getTimestamp() <= commitPoint.opTime.getTimestamp(),
+ str::stream() << "snapshotOpTime: " << snapshotOpTime.toString()
+ << " commitPoint: " << commitPoint.opTime.toString());
+ invariant(snapshotOpTime <= commitPoint.opTime,
+ str::stream() << "snapshotOpTime: " << snapshotOpTime.toString()
+ << " commitPoint: " << commitPoint.opTime.toString());
}
// When majority read concern is disabled, the stable opTime is set to the lastApplied, rather
@@ -3802,9 +3809,14 @@ boost::optional<OpTimeAndWallTime> ReplicationCoordinatorImpl::_recalculateStabl
_chooseStableOpTimeFromCandidates(lk, _stableOpTimeCandidates, maximumStableOpTime);
if (stableOpTime) {
// Check that the selected stable optime does not exceed our maximum.
- invariant(stableOpTime.get().opTime.getTimestamp() <=
- maximumStableOpTime.opTime.getTimestamp());
- invariant(stableOpTime.get().opTime <= maximumStableOpTime.opTime);
+ invariant(
+ stableOpTime.get().opTime.getTimestamp() <= maximumStableOpTime.opTime.getTimestamp(),
+ str::stream() << "stableOpTime: " << stableOpTime.get().opTime.toString()
+ << " maximumStableOpTime: " << maximumStableOpTime.opTime.toString());
+ invariant(stableOpTime.get().opTime <= maximumStableOpTime.opTime,
+ str::stream() << "stableOpTime: " << stableOpTime.get().opTime.toString()
+ << " maximumStableOpTime: "
+ << maximumStableOpTime.opTime.toString());
}
return stableOpTime;