Skip to content

Commit 12c28db

Browse files
committed
SERVER-42586 Change massert to fassert when inserting documents for the oplog fails
1 parent f701850 commit 12c28db

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/mongo/db/repl/oplog.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ MONGO_FAIL_POINT_DEFINE(sleepBetweenInsertOpTimeGenerationAndLogOp);
115115
// are visible, but before we have advanced 'lastApplied' for the write.
116116
MONGO_FAIL_POINT_DEFINE(hangBeforeLogOpAdvancesLastApplied);
117117

118-
// so we can fail the same way
119-
void checkOplogInsert(Status result) {
120-
massert(17322, str::stream() << "write to oplog failed: " << result.toString(), result.isOK());
121-
}
122-
123118
bool shouldBuildInForeground(OperationContext* opCtx,
124119
const BSONObj& index,
125120
const NamespaceString& indexNss,
@@ -327,7 +322,11 @@ void _logOpsInner(OperationContext* opCtx,
327322
str::stream() << "logOp() but can't accept write to collection " << nss.ns());
328323
}
329324

330-
checkOplogInsert(oplogCollection->insertDocumentsForOplog(opCtx, records, timestamps));
325+
Status result = oplogCollection->insertDocumentsForOplog(opCtx, records, timestamps);
326+
if (!result.isOK()) {
327+
severe() << "write to oplog failed: " << result.toString();
328+
fassertFailed(17322);
329+
}
331330

332331
// Set replCoord last optime only after we're sure the WUOW didn't abort and roll back.
333332
opCtx->recoveryUnit()->onCommit(

0 commit comments

Comments
 (0)