summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-06-05 16:44:52 -0400
committerBenety Goh <benety@mongodb.com>2018-06-05 16:44:52 -0400
commit09ea5600193cee30260c4d0a114f6464b870ab84 (patch)
treea0b239c610541ec29017901ac66d8de00a18c68f /src/mongo/db
parent5377292873f5b203c401384567457b2987502528 (diff)
downloadmongo-09ea5600193cee30260c4d0a114f6464b870ab84.tar.gz
SERVER-32935 log exception during oplog application
This change uses the terminate handler to log unexpected exceptions thrown inside SyncTail::oplogApplication().
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/sync_tail.cpp8
-rw-r--r--src/mongo/db/repl/sync_tail.h4
-rw-r--r--src/mongo/db/repl/sync_tail_test.cpp2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index cb5d5441b5d..11e277188b2 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -773,6 +773,12 @@ void SyncTail::oplogApplication(OplogBuffer* oplogBuffer, ReplicationCoordinator
OpQueueBatcher batcher(this, _storageInterface, oplogBuffer);
+ _oplogApplication(oplogBuffer, replCoord, &batcher);
+}
+
+void SyncTail::_oplogApplication(OplogBuffer* oplogBuffer,
+ ReplicationCoordinator* replCoord,
+ OpQueueBatcher* batcher) noexcept {
std::unique_ptr<ApplyBatchFinalizer> finalizer{
getGlobalServiceContext()->getStorageEngine()->isDurable()
? new ApplyBatchFinalizerForJournal(replCoord)
@@ -811,7 +817,7 @@ void SyncTail::oplogApplication(OplogBuffer* oplogBuffer, ReplicationCoordinator
long long termWhenBufferIsEmpty = replCoord->getTerm();
// Blocks up to a second waiting for a batch to be ready to apply. If one doesn't become
// ready in time, we'll loop again so we can do the above checks periodically.
- OpQueue ops = batcher.getNextBatch(Seconds(1));
+ OpQueue ops = batcher->getNextBatch(Seconds(1));
if (ops.empty()) {
if (ops.mustShutdown()) {
// Shut down and exit oplog application loop.
diff --git a/src/mongo/db/repl/sync_tail.h b/src/mongo/db/repl/sync_tail.h
index 648b22133bf..bc0ff496541 100644
--- a/src/mongo/db/repl/sync_tail.h
+++ b/src/mongo/db/repl/sync_tail.h
@@ -243,6 +243,10 @@ private:
class OpQueueBatcher;
+ void _oplogApplication(OplogBuffer* oplogBuffer,
+ ReplicationCoordinator* replCoord,
+ OpQueueBatcher* batcher) noexcept;
+
OplogApplier::Observer* const _observer;
ReplicationConsistencyMarkers* const _consistencyMarkers;
StorageInterface* const _storageInterface;
diff --git a/src/mongo/db/repl/sync_tail_test.cpp b/src/mongo/db/repl/sync_tail_test.cpp
index 2d12920515e..123a7eb3a14 100644
--- a/src/mongo/db/repl/sync_tail_test.cpp
+++ b/src/mongo/db/repl/sync_tail_test.cpp
@@ -1110,7 +1110,7 @@ public:
DEATH_TEST_F(SyncTailTest,
OplogApplicationLogsExceptionFromSignalDrainCompleteBeforeAborting,
- "Invariant failure _isDead") {
+ "OperationFailed: failed to signal drain complete") {
// Leave oplog buffer empty so that SyncTail calls
// ReplicationCoordinator::signalDrainComplete() during oplog application.
auto oplogBuffer = std::make_unique<OplogBufferBlockingQueue>();