diff options
author | Dwight <dmerriman@gmail.com> | 2008-07-11 12:27:23 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-07-11 12:27:23 -0400 |
commit | 51bb240a58e2f80c338a8295f837711dad1a713b (patch) | |
tree | f2ba89a893ef3dc5c779a35b8f7d70e86bc4267e /db | |
parent | 86fd5369aa675b0f0aa2ed46877c32e3a73b9521 (diff) | |
download | mongo-51bb240a58e2f80c338a8295f837711dad1a713b.tar.gz |
--nojni option.
Diffstat (limited to 'db')
-rw-r--r-- | db/db.cpp | 48 | ||||
-rw-r--r-- | db/jsobj.cpp | 2 | ||||
-rw-r--r-- | db/pdfile.cpp | 3 | ||||
-rw-r--r-- | db/query.cpp | 6 |
4 files changed, 26 insertions, 33 deletions
diff --git a/db/db.cpp b/db/db.cpp index d9e04348850..55db7028ae4 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -13,10 +13,11 @@ #include "query.h" #include "introspect.h" +bool useJNI = true; extern const char *dbpath; extern int curOp; -/* only off if --nocursor which is for debugging. */ +/* only off if --nocursors which is for debugging. */ bool useCursors = true; boost::mutex dbMutex; @@ -230,11 +231,9 @@ void receivedQuery(DbResponse& dbresponse, /*AbstractMessagingPort& dbMsgPort, * } catch( AssertionException ) { ss << " exception "; - problem() << " Caught Assertion in runQuery " << ns << endl; - cout << " Caught Assertion in runQuery, continuing" << endl; - cout << " ntoskip:" << ntoskip << " ntoreturn:" << ntoreturn << endl; - cout << " ns:" << ns << endl; - cout << " query:" << query.toString() << endl; + problem() << " Caught Assertion in runQuery ns:" << ns << endl; + cout << " ntoskip:" << ntoskip << " ntoreturn:" << ntoreturn << '\n'; + cout << " query:" << query.toString() << '\n'; msgdata = (QueryResult*) malloc(sizeof(QueryResult)); QueryResult *qr = msgdata; qr->_data[0] = 0; @@ -445,7 +444,6 @@ void jniCallback(Message& m, Message& out) } catch( AssertionException ) { problem() << "Caught Assertion in kill cursors, continuing" << endl; - cout << "Caught Assertion in kill cursors, continuing" << endl; ss << " exception "; } } @@ -471,7 +469,6 @@ void jniCallback(Message& m, Message& out) } catch( AssertionException ) { problem() << "Caught AssertionException in jniCall()" << endl; - cout << "Caught AssertionException in jniCall()" << endl; } curOp = curOpOld; @@ -569,7 +566,6 @@ void connThread() } catch( AssertionException ) { problem() << " Caught Assertion insert, continuing" << endl; - cout << "Caught Assertion, continuing" << endl; ss << " exception "; } } @@ -581,7 +577,6 @@ void connThread() } catch( AssertionException ) { problem() << " Caught Assertion update, continuing" << endl; - cout << "Caught Assertion update, continuing" << endl; ss << " exception "; } } @@ -593,7 +588,6 @@ void connThread() } catch( AssertionException ) { problem() << " Caught Assertion receivedDelete, continuing" << endl; - cout << "Caught Assertion receivedDelete, continuing" << endl; ss << " exception "; } } @@ -611,7 +605,6 @@ void connThread() receivedKillCursors(m); } catch( AssertionException ) { - cout << "Caught Assertion in kill cursors, continuing" << endl; problem() << " Caught Assertion in kill cursors, continuing" << endl; ss << " exception "; } @@ -735,7 +728,7 @@ void setupSignals() {} #endif void initAndListen(int listenPort, const char *dbPath, const char *appserverLoc = null) { - if( opLogging ) + if( opLogging ) cout << "opLogging = " << opLogging << endl; _oplog.init(); @@ -768,8 +761,10 @@ void initAndListen(int listenPort, const char *dbPath, const char *appserverLoc cout << "10Gen DB : starting : pid = " << pid << " port = " << port << " dbpath = " << dbpath << endl; problem() << "10Gen DB : starting : pid = " << pid << " port = " << port << " dbpath = " << dbpath << endl; - JavaJS = new JavaJSImpl(appserverLoc); - javajstest(); + if( useJNI ) { + JavaJS = new JavaJSImpl(appserverLoc); + javajstest(); + } setupSignals(); @@ -872,21 +867,20 @@ int main(int argc, char* argv[], char *envp[] ) for (int i = 1; i < argc; i++) { - char *s = argv[i]; - if( s == 0 ) continue; - - if (strcmp(s, "--port") == 0) { + if( argv[i] == 0 ) continue; + string s = argv[i]; + + if( s == "--port" ) port = atoi(argv[++i]); - } - else if (strcmp(s, "--dbpath") == 0) { + else if( s == "--nojni" ) + useJNI = false; + else if( s == "--dbpath" ) dbpath = argv[++i]; - } - else if (strcmp(s, "--appsrvpath") == 0) { + else if( s == "--appsrvpath" ) appsrvPath = argv[++i]; - } - else if( strcmp(s, "--nocursors") == 0) + else if( s == "--nocursors" ) useCursors = false; - else if( strncmp(s, "--oplog", 7) == 0 ) { + else if( strncmp(s.c_str(), "--oplog", 7) == 0 ) { int x = s[7] - '0'; if( x < 0 || x > 7 ) { cout << "can't interpret --oplog setting" << endl; @@ -913,7 +907,7 @@ int main(int argc, char* argv[], char *envp[] ) cout << " dev run in dev mode (diff db loc, diff port #)" << endl; cout << endl << "Alternate Usage :" << endl; cout << " --port <portno> --dbpath <root> --appsrvpath <root of appsrv>" << endl; - cout << " --nocursors" << endl; + cout << " --nocursors --nojni" << endl; cout << " --oplog<n> 0=off 1=W 2=R 3=both 7=W+some reads" << endl; cout << endl; diff --git a/db/jsobj.cpp b/db/jsobj.cpp index 6fe927efafd..02d00192058 100644 --- a/db/jsobj.cpp +++ b/db/jsobj.cpp @@ -321,7 +321,7 @@ JSMatcher::JSMatcher(JSObj &_jsobj) : assert( where == 0 ); where = new Where(); const char *code = e.valuestr(); - assert( JavaJS ); + massert( "$where query, but jni is disabled", JavaJS ); where->scope = JavaJS->scopeCreate(); JavaJS->scopeSetString(where->scope, "$client", client->name.c_str()); where->setFunc(code); diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 1f6282ccb86..6563e41ae77 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -690,7 +690,6 @@ void _unindexRecord(const char *ns, IndexDetails& id, JSObj& obj, const DiskLoc& ok = id.head.btree()->unindex(id.head, id, j, dl); } catch(AssertionException) { - cout << " caught assertion _unindexRecord " << id.indexNamespace() << '\n'; problem() << "Assertion failure: _unindex failed " << id.indexNamespace() << endl; cout << "Assertion failure: _unindex failed" << '\n'; cout << " obj:" << obj.toString() << '\n'; @@ -842,7 +841,6 @@ void DataFileMgr::update( } catch(AssertionException) { ss << " exception update unindex "; - cout << " caught assertion update unindex " << idxns.c_str() << '\n'; problem() << " caught assertion update unindex " << idxns.c_str() << endl; } } @@ -896,7 +894,6 @@ void _indexRecord(IndexDetails& idx, JSObj& obj, DiskLoc newRecordLoc) { (JSObj&) *i, false, idx, true); } catch(AssertionException) { - cout << " caught assertion _indexRecord " << idx.indexNamespace() << '\n'; problem() << " caught assertion _indexRecord " << idx.indexNamespace() << endl; } } diff --git a/db/query.cpp b/db/query.cpp index e09bb2d3fbe..49b87d90f2f 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -474,8 +474,10 @@ bool dbEval(JSObj& cmd, JSObjBuilder& result) { Element e = cmd.firstElement(); assert( e.type() == Code ); const char *code = e.valuestr(); - if ( ! JavaJS ) - JavaJS = new JavaJSImpl(); + if ( ! JavaJS ) { + result.append("errmsg", "db side execution is disabled"); + return false; + } jlong f = JavaJS->functionCreate(code); if( f == 0 ) { |