Skip to content

Commit 1d2bba9

Browse files
committed
SERVER-14527 Do not setLastError in assert_util.
MongoD and MongoS set it explicitly for write commands and wire writes, and in the forceerror command, which is better than invoking it every time an assertion is thrown. It prevents swallowed exceptions from being reported, and obviates the LastError::Disabled type and "last error disabled" functionality in general.
1 parent d7d72de commit 1d2bba9

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/mongo/util/assert_util.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ using namespace std;
3939
#endif
4040

4141
#include "mongo/bson/bsonobjbuilder.h"
42-
#include "mongo/db/lasterror.h"
4342
#include "mongo/util/stacktrace.h"
4443

4544
namespace mongo {
@@ -111,7 +110,6 @@ namespace mongo {
111110

112111
log() << "warning assertion failure " << msg << ' ' << file << ' ' << dec << line << endl;
113112
logContext();
114-
setLastError(0,msg && *msg ? msg : "wassertion failure");
115113
assertionCount.condrollover( ++assertionCount.warning );
116114
#if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF)
117115
// this is so we notice in buildbot
@@ -124,7 +122,6 @@ namespace mongo {
124122
assertionCount.condrollover( ++assertionCount.regular );
125123
log() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl;
126124
logContext();
127-
setLastError(0,msg && *msg ? msg : "assertion failure");
128125
stringstream temp;
129126
temp << "assertion " << file << ":" << line;
130127
AssertionException e(temp.str(),0);
@@ -178,7 +175,6 @@ namespace mongo {
178175
NOINLINE_DECL void uasserted(int msgid, const char *msg) {
179176
assertionCount.condrollover( ++assertionCount.user );
180177
LOG(1) << "User Assertion: " << msgid << ":" << msg << endl;
181-
setLastError(msgid,msg);
182178
throw UserException(msgid, msg);
183179
}
184180

@@ -189,7 +185,6 @@ namespace mongo {
189185
NOINLINE_DECL void msgasserted(int msgid, const char *msg) {
190186
assertionCount.condrollover( ++assertionCount.warning );
191187
log() << "Assertion: " << msgid << ":" << msg << endl;
192-
setLastError(msgid,msg && *msg ? msg : "massert failure");
193188
//breakpoint();
194189
logContext();
195190
throw MsgAssertionException(msgid, msg);
@@ -198,7 +193,6 @@ namespace mongo {
198193
NOINLINE_DECL void msgassertedNoTrace(int msgid, const char *msg) {
199194
assertionCount.condrollover( ++assertionCount.warning );
200195
log() << "Assertion: " << msgid << ":" << msg << endl;
201-
setLastError(msgid,msg && *msg ? msg : "massert failure");
202196
throw MsgAssertionException(msgid, msg);
203197
}
204198

0 commit comments

Comments
 (0)