Status WiredTigerSnapshotManager::setTransactionReadTimestamp(Timestamp pointInTime, WT_SESSION* session, bool roundToOldest) const { char readTSConfigString[15 /* read_timestamp= */ + 16 /* 16 hexadecimal digits */ + 17 /* ,round_to_oldest= */ + 5 /* false */ + 1 /* trailing null */]; auto size = std::snprintf(readTSConfigString, sizeof(readTSConfigString), "read_timestamp=%llx,round_to_oldest=%s", pointInTime.asULL(), (roundToOldest) ? "true" : "false"); if (size < 0) { int e = errno; error() << "error snprintf " << errnoWithDescription(e); fassertFailedNoTrace(40664); } invariant(static_cast<std::size_t>(size) < sizeof(readTSConfigString)); return wtRCToStatus(session->timestamp_transaction(session, readTSConfigString)); }
Status WiredTigerRecoveryUnit::setTimestamp(Timestamp timestamp) { _ensureSession(); LOG(3) << "WT set timestamp of future write operations to " << timestamp; WT_SESSION* session = _session->getSession(); invariant(_inUnitOfWork(), toString(_state)); invariant(_prepareTimestamp.isNull()); invariant(_commitTimestamp.isNull(), str::stream() << "Commit timestamp set to " << _commitTimestamp.toString() << " and trying to set WUOW timestamp to " << timestamp.toString()); _lastTimestampSet = timestamp; // Starts the WT transaction associated with this session. getSession(); const std::string conf = "commit_timestamp=" + integerToHex(timestamp.asULL()); auto rc = session->timestamp_transaction(session, conf.c_str()); if (rc == 0) { _isTimestamped = true; } return wtRCToStatus(rc, "timestamp_transaction"); }
void WiredTigerOplogManager::setOplogReadTimestamp(Timestamp ts) { stdx::lock_guard<stdx::mutex> lk(_oplogVisibilityStateMutex); _setOplogReadTimestamp(lk, ts.asULL()); }