diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/dur_journal.cpp | 2 | ||||
-rw-r--r-- | db/oplog.cpp | 8 | ||||
-rw-r--r-- | db/ops/query.cpp | 14 | ||||
-rw-r--r-- | db/repl/rs.cpp | 9 |
4 files changed, 25 insertions, 8 deletions
diff --git a/db/dur_journal.cpp b/db/dur_journal.cpp index 95a95c9..d7ef58f 100644 --- a/db/dur_journal.cpp +++ b/db/dur_journal.cpp @@ -687,7 +687,7 @@ namespace mongo { // must already be open -- so that _curFileId is correct for previous buffer building assert( _curLogFile ); - stats.curr->_uncompressedBytes += b.len(); + stats.curr->_uncompressedBytes += uncompressed.len(); unsigned w = b.len(); _written += w; assert( w <= L ); diff --git a/db/oplog.cpp b/db/oplog.cpp index 6e62607..f4521f2 100644 --- a/db/oplog.cpp +++ b/db/oplog.cpp @@ -629,16 +629,16 @@ namespace mongo { OplogReader missingObjReader; const char *ns = o.getStringField("ns"); + // should already have write lock + Client::Context ctx(ns); + // capped collections NamespaceDetails *nsd = nsdetails(ns); if (nsd && nsd->capped) { log() << "replication missing doc, but this is okay for a capped collection (" << ns << ")" << endl; return false; } - - // should already have write lock - Client::Context ctx(ns); - + // we don't have the object yet, which is possible on initial sync. get it. log() << "replication info adding missing object" << endl; // rare enough we can log uassert(15916, str::stream() << "Can no longer connect to initial sync source: " << hn, missingObjReader.connect(hn)); diff --git a/db/ops/query.cpp b/db/ops/query.cpp index 36f2536..1010912 100644 --- a/db/ops/query.cpp +++ b/db/ops/query.cpp @@ -816,6 +816,7 @@ namespace mongo { curop.debug().ns = ns; curop.debug().ntoreturn = pq.getNumToReturn(); + curop.debug().query = jsobj; curop.setQuery(jsobj); if ( pq.couldBeCommand() ) { @@ -916,6 +917,19 @@ namespace mongo { Client& c = cc(); bool found = Helpers::findById( c, ns , query , resObject , &nsFound , &indexFound ); if ( nsFound == false || indexFound == true ) { + + if ( shardingState.needShardChunkManager( ns ) ) { + ShardChunkManagerPtr m = shardingState.getShardChunkManager( ns ); + if ( m && ! m->belongsToMe( resObject ) ) { + // I have something this _id + // but it doesn't belong to me + // so return nothing + resObject = BSONObj(); + found = false; + } + } + + BufBuilder bb(sizeof(QueryResult)+resObject.objsize()+32); bb.skip(sizeof(QueryResult)); diff --git a/db/repl/rs.cpp b/db/repl/rs.cpp index f827291..23abc24 100644 --- a/db/repl/rs.cpp +++ b/db/repl/rs.cpp @@ -100,17 +100,20 @@ namespace mongo { lock lk(this); Member *max = 0; - - for (set<unsigned>::iterator it = _electableSet.begin(); it != _electableSet.end(); it++) { + set<unsigned>::iterator it = _electableSet.begin(); + while ( it != _electableSet.end() ) { const Member *temp = findById(*it); if (!temp) { log() << "couldn't find member: " << *it << endl; - _electableSet.erase(*it); + set<unsigned>::iterator it_delete = it; + it++; + _electableSet.erase(it_delete); continue; } if (!max || max->config().priority < temp->config().priority) { max = (Member*)temp; } + it++; } return max; |