summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-06-11 17:15:28 -0400
committerDwight <dmerriman@gmail.com>2008-06-11 17:15:28 -0400
commit543621e070e54efa09c4417e20a696eb94f11f02 (patch)
tree15207b0e7d8317c27f21d15aa3dd820d52083717
parent131e2eb860639e14234c9e004c5910635549f2b4 (diff)
downloadmongo-r0.0.4_rc3.tar.gz
v114 merge patchr0.0.4_rc3
-rw-r--r--db/db.cpp10
-rw-r--r--db/query.cpp3
-rw-r--r--db/query.h3
-rw-r--r--grid/message.cpp4
-rw-r--r--grid/message.h2
5 files changed, 17 insertions, 5 deletions
diff --git a/db/db.cpp b/db/db.cpp
index 1d417c093f3..a4133fb04ed 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -152,6 +152,7 @@ void receivedDelete(Message& m) {
}
void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& ss) {
+ MSGID responseTo = m.data->id;
DbMessage d(m);
const char *ns = d.getns();
setClient(ns);
@@ -166,7 +167,7 @@ void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& s
QueryResult* msgdata;
try {
- msgdata = runQuery(ns, ntoskip, ntoreturn, query, fields, ss);
+ msgdata = runQuery(m, ns, ntoskip, ntoreturn, query, fields, ss);
}
catch( AssertionException ) {
ss << " exception ";
@@ -196,7 +197,7 @@ void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& s
else {
cout << "ERROR: client is null; ns=" << ns << endl;
}
- dbMsgPort.reply(m, resp);
+ dbMsgPort.reply(m, resp, responseTo);
}
void receivedGetMore(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& ss) {
@@ -274,7 +275,7 @@ public:
};
void listen(int port) {
- const char *Version = "db version: 112 6jun2008";
+ const char *Version = "db version: 112.patch114 11jun2008";
problem() << Version << endl;
cout << Version << endl;
pdfileInit();
@@ -290,6 +291,9 @@ extern int callDepth;
class JniMessagingPort : public AbstractMessagingPort {
public:
JniMessagingPort(Message& _container) : container(_container) { }
+ void reply(Message& received, Message& response, MSGID) {
+ container = response;
+ }
void reply(Message& received, Message& response) {
container = response;
}
diff --git a/db/query.cpp b/db/query.cpp
index 2a624977630..1cd60df52b4 100644
--- a/db/query.cpp
+++ b/db/query.cpp
@@ -639,7 +639,7 @@ void killCursors(int n, long long *ids) {
auto_ptr<Cursor> findTableScan(const char *ns, JSObj& order);
-QueryResult* runQuery(const char *ns, int ntoskip, int _ntoreturn, JSObj jsobj,
+QueryResult* runQuery(Message& message, const char *ns, int ntoskip, int _ntoreturn, JSObj jsobj,
auto_ptr< set<string> > filter, stringstream& ss)
{
bool wantMore = true;
@@ -740,6 +740,7 @@ assert( debug.getN() < 5000 );
ClientCursor::add(cc);
cc->updateLocation();
cc->filter = filter;
+ cc->originalMessage = message;
}
}
break;
diff --git a/db/query.h b/db/query.h
index b0f7a503fcb..e8b9216b7b0 100644
--- a/db/query.h
+++ b/db/query.h
@@ -68,7 +68,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,
+QueryResult* runQuery(Message&, const char *ns, int ntoskip, int ntoreturn,
JSObj j, auto_ptr< set<string> > fieldFilter,
stringstream&);
@@ -102,6 +102,7 @@ public:
int pos;
DiskLoc lastLoc;
auto_ptr< set<string> > filter;
+ Message originalMessage;
/* report to us that a new clientcursor exists so we can track it. You still
do the initial updateLocation() yourself.
diff --git a/grid/message.cpp b/grid/message.cpp
index caf2cd7e8a8..f2befbb74fa 100644
--- a/grid/message.cpp
+++ b/grid/message.cpp
@@ -160,6 +160,10 @@ void MessagingPort::reply(Message& received, Message& response) {
say(received.from, response, received.data->id);
}
+void MessagingPort::reply(Message& received, Message& response, MSGID responseTo) {
+ say(received.from, response, responseTo);
+}
+
bool MessagingPort::call(SockAddr& to, Message& toSend, Message& response) {
mmm( cout << "*call()" << endl; )
MSGID old = toSend.data->id;
diff --git a/grid/message.h b/grid/message.h
index 604e9a67343..15698ed8f12 100644
--- a/grid/message.h
+++ b/grid/message.h
@@ -22,6 +22,7 @@ private:
class AbstractMessagingPort {
public:
+ virtual void reply(Message& received, Message& response,MSGID) = 0;
virtual void reply(Message& received, Message& response) = 0;
};
@@ -40,6 +41,7 @@ public:
*/
bool recv(Message& m);
void reply(Message& received, Message& response);
+ void reply(Message& received, Message& response, MSGID);
bool call(SockAddr& to, Message& toSend, Message& response);
void say(SockAddr& to, Message& toSend, int responseTo = -1);