mirror of https://github.com/mongodb/mongo
catch asserts on queries (always now)
prints the query in the log now too still can terminate on getMore()
This commit is contained in:
parent
0fafc08113
commit
13e6a66d08
28
db/db.cpp
28
db/db.cpp
|
|
@ -175,10 +175,30 @@ void receivedQuery(MessagingPort& dbMsgPort, Message& m, stringstream& ss) {
|
|||
fields = auto_ptr< set<string> >(new set<string>());
|
||||
d.nextJsObj().getFieldNames(*fields);
|
||||
}
|
||||
QueryResult* msgdata =
|
||||
runQuery(ns, ntoskip, ntoreturn, query, fields, ss);
|
||||
QueryResult* msgdata;
|
||||
|
||||
try {
|
||||
msgdata = runQuery(ns, ntoskip, ntoreturn, query, fields, ss);
|
||||
}
|
||||
catch( AssertionException ) {
|
||||
cout << " Caught Assertion in runQuery, continuing" << endl;
|
||||
cout << " ntoskip:" << ntoskip << " ntoreturn:" << ntoreturn << endl;
|
||||
cout << " ns:" << ns << endl;
|
||||
cout << " query:" << query.toString() << endl;
|
||||
msgdata = (QueryResult*) malloc(sizeof(QueryResult));
|
||||
QueryResult *qr = msgdata;
|
||||
qr->_data[0] = 0;
|
||||
qr->_data[1] = 0;
|
||||
qr->_data[2] = 0;
|
||||
qr->_data[3] = 0;
|
||||
qr->len = sizeof(QueryResult);
|
||||
qr->operation = opReply;
|
||||
qr->cursorId = 0;
|
||||
qr->startingFrom = 0;
|
||||
qr->nReturned = 0;
|
||||
}
|
||||
Message resp;
|
||||
resp.setData(msgdata, true);
|
||||
resp.setData(msgdata, true); // transport will free
|
||||
dbMsgPort.reply(m, resp);
|
||||
client = 0;
|
||||
}
|
||||
|
|
@ -252,7 +272,7 @@ public:
|
|||
};
|
||||
|
||||
void listen(int port) {
|
||||
cout << "db version: 24feb08.1 embedded objects indexable" << endl;
|
||||
cout << "db version: 24feb08.1 embedded objects indexable; catch query asserts" << endl;
|
||||
pdfileInit();
|
||||
testTheDb();
|
||||
cout << curTimeMillis() % 10000 << " waiting for connections...\n" << endl;
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ QueryResult* runQuery(const char *ns, int ntoskip, int ntoreturn, JSObj jsobj,
|
|||
int nscanned = 0;
|
||||
auto_ptr<Cursor> c = getSpecialCursor(ns);
|
||||
|
||||
try{
|
||||
/*try*/{
|
||||
|
||||
if( c.get() == 0 ) {
|
||||
c = getIndexCursor(ns, query, order);
|
||||
|
|
@ -554,15 +554,15 @@ QueryResult* runQuery(const char *ns, int ntoskip, int ntoreturn, JSObj jsobj,
|
|||
if( queryTraceLevel >=2 )
|
||||
cout << " nscanned:" << nscanned << "\n ";
|
||||
}
|
||||
catch( AssertionException e ) {
|
||||
/*catch( AssertionException e ) {
|
||||
if( n )
|
||||
throw e;
|
||||
if( nCaught++ >= 100 ) {
|
||||
if( nCaught++ >= 1000 ) {
|
||||
cout << "Too many query exceptions, terminating" << endl;
|
||||
exit(-8);
|
||||
}
|
||||
cout << " Assertion running query, returning an empty result" << endl;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
QueryResult *qr = (QueryResult *) b.buf();
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ struct QueryResult : public MsgData {
|
|||
|
||||
QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid);
|
||||
|
||||
// caller must free() returned QueryResult.
|
||||
QueryResult* runQuery(const char *ns, int ntoskip, int ntoreturn,
|
||||
JSObj j, auto_ptr< set<string> > fieldFilter,
|
||||
stringstream&);
|
||||
|
|
|
|||
Loading…
Reference in New Issue