diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 45f400e264..0f1cff1f43 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -1531,11 +1531,19 @@ StatusWith multiApply(OperationContext* opCtx, pinningTransaction->beginUnitOfWork(opCtx); fassertStatusOK(40677, pinningTransaction->setTimestamp(ops.front().getTimestamp())); } + LOG(0) << "Start batch ts: " << ops.front().getTimestamp(); + + for (auto it = ops.begin(); it != ops.end(); ++it) { + invariant(it->getTimestamp() >= ops.front().getTimestamp()); + invariant(it->getTimestamp() <= ops.back().getTimestamp()); + } // We must wait for the all work we've dispatched to complete before leaving this block // because the spawned threads refer to objects on the stack ON_BLOCK_EXIT([&] { workerPool->join(); + LOG(0) << "Finish batch ts: " << ops.back().getTimestamp(); + if (pinOldestTimestamp) { pinningTransaction->abortUnitOfWork(); } @@ -1575,10 +1583,12 @@ StatusWith multiApply(OperationContext* opCtx, // If any of the statuses is not ok, return error. for (auto& status : statusVector) { if (!status.isOK()) { + LOG(0) << "Had an error. Status: " << status.reason(); return status; } } + LOG(0) << "Successfully finished. TS: " << ops.back().getOpTime(); // We have now written all database writes and updated the oplog to match. return ops.back().getOpTime(); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 277ac8faba..1d5a8626fb 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -1053,7 +1053,7 @@ void WiredTigerKVEngine::setOldestTimestamp(Timestamp oldestTimestamp) { _oplogManager->setOplogReadTimestamp(oldestTimestamp); _previousSetOldestTimestamp = oldestTimestamp; - LOG(1) << "Forced a new oldest_timestamp. Value: " << oldestTimestamp; + LOG(0) << "Forced a new oldest_timestamp. Value: " << oldestTimestamp; } void WiredTigerKVEngine::advanceOldestTimestamp(Timestamp oldestTimestamp) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp index 95a6b14e1e..0997126975 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp @@ -107,7 +107,7 @@ void WiredTigerOplogManager::waitForAllEarlierOplogWritesToBeVisible( oplogRecordStore->getCursor(opCtx, false /* false = reverse cursor */); auto lastRecord = cursor->next(); if (!lastRecord) { - LOG(2) << "Trying to query an empty oplog"; + LOG(0) << "Trying to query an empty oplog"; opCtx->recoveryUnit()->abandonSnapshot(); return; } @@ -119,7 +119,7 @@ void WiredTigerOplogManager::waitForAllEarlierOplogWritesToBeVisible( opCtx->waitForConditionOrInterrupt(_opsBecameVisibleCV, lk, [&] { auto newLatestVisibleTimestamp = getOplogReadTimestamp(); if (newLatestVisibleTimestamp < currentLatestVisibleTimestamp) { - LOG(1) << "oplog latest visible timestamp went backwards"; + LOG(0) << "oplog latest visible timestamp went backwards"; // If the visibility went backwards, this means a rollback occurred. // Thus, we are finished waiting. return true; @@ -132,9 +132,9 @@ void WiredTigerOplogManager::waitForAllEarlierOplogWritesToBeVisible( RecordId latestVisible = std::max(RecordId(currentLatestVisibleTimestamp), _oplogMaxAtStartup); if (latestVisible < waitingFor) { - LOG(2) << "Operation is waiting for " << waitingFor << "; latestVisible is " - << currentLatestVisibleTimestamp << " oplogMaxAtStartup is " - << _oplogMaxAtStartup; + LOG(0) << "Operation is waiting for " << Timestamp(waitingFor.repr()) + << "; latestVisible is " << Timestamp(currentLatestVisibleTimestamp) + << " oplogMaxAtStartup is " << _oplogMaxAtStartup; } return latestVisible >= waitingFor; }); @@ -180,7 +180,7 @@ void WiredTigerOplogManager::_oplogJournalThreadLoop(WiredTigerSessionCache* ses const uint64_t newTimestamp = _fetchAllCommittedValue(sessionCache->conn()); if (newTimestamp == _oplogReadTimestamp.load()) { - LOG(2) << "no new oplog entries were made visible: " << newTimestamp; + LOG(0) << "no new oplog entries were made visible: " << Timestamp(newTimestamp); continue; } @@ -217,7 +217,7 @@ void WiredTigerOplogManager::setOplogReadTimestamp(Timestamp ts) { void WiredTigerOplogManager::_setOplogReadTimestamp(WithLock, uint64_t newTimestamp) { _oplogReadTimestamp.store(newTimestamp); _opsBecameVisibleCV.notify_all(); - LOG(2) << "setting new oplogReadTimestamp: " << newTimestamp; + LOG(0) << "setting new oplogReadTimestamp: " << Timestamp(newTimestamp); } uint64_t WiredTigerOplogManager::_fetchAllCommittedValue(WT_CONNECTION* conn) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index 6b699bdb0f..d0a3a3dd77 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -1722,6 +1722,7 @@ boost::optional WiredTigerRecordStoreCursorBase::seekExact(const RecordI // Nothing after the next line can throw WCEs. int seekRet = WT_READ_CHECK(c->search(c)); if (seekRet == WT_NOTFOUND) { + LOG(0) << "Seek did not find a record. Id: " << Timestamp(id.repr()); // hasWrongPrefix check not needed for a precise 'WT_CURSOR::search'. _eof = true; return {}; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.cpp index a554015102..4910cb4f77 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.cpp @@ -124,6 +124,9 @@ void WiredTigerSnapshotManager::beginTransactionOnOplog(WiredTigerOplogManager* invariant(static_cast(size) < sizeof(readTSConfigString)); int status = session->begin_transaction(session, readTSConfigString); + LOG(0) << "Beginning oplog transaction. Size: " << size + << " ReadSize: " << sizeof(readTSConfigString) + << " TS: " << Timestamp(allCommittedTimestamp); // If begin_transaction returns EINVAL, we will assume it is due to the oldest_timestamp // racing ahead of the read_timestamp. Rather than synchronizing for this rare case, throw a