summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/client/parallel.cpp21
-rw-r--r--src/mongo/client/parallel.h5
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp3
-rw-r--r--src/mongo/db/db.cpp10
-rw-r--r--src/mongo/db/ops/delete_executor.cpp3
-rw-r--r--src/mongo/db/query/cached_plan_runner.cpp11
-rw-r--r--src/mongo/db/query/multi_plan_runner.cpp12
-rw-r--r--src/mongo/db/structure/btree/btree_logic.cpp21
-rw-r--r--src/mongo/db/structure/btree/btree_logic.h5
-rw-r--r--src/mongo/db/structure/record_store_v1_simple.cpp3
-rw-r--r--src/mongo/util/log.cpp3
-rw-r--r--src/mongo/util/log.h6
-rw-r--r--src/mongo/util/mmap_posix.cpp3
13 files changed, 33 insertions, 73 deletions
diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp
index 2599a8bd7b4..53c572d51f4 100644
--- a/src/mongo/client/parallel.cpp
+++ b/src/mongo/client/parallel.cpp
@@ -176,19 +176,10 @@ namespace mongo {
}
// -------- FilteringClientCursor -----------
- FilteringClientCursor::FilteringClientCursor( const BSONObj filter )
- : _matcher( filter ) , _pcmData( NULL ), _done( true ) {
+ FilteringClientCursor::FilteringClientCursor()
+ : _pcmData( NULL ), _done( true ) {
}
- FilteringClientCursor::FilteringClientCursor( auto_ptr<DBClientCursor> cursor , const BSONObj filter )
- : _matcher( filter ) , _cursor( cursor ) , _pcmData( NULL ), _done( cursor.get() == 0 ) {
- }
-
- FilteringClientCursor::FilteringClientCursor( DBClientCursor* cursor , const BSONObj filter )
- : _matcher( filter ) , _cursor( cursor ) , _pcmData( NULL ), _done( cursor == 0 ) {
- }
-
-
FilteringClientCursor::~FilteringClientCursor() {
// Don't use _pcmData
_pcmData = NULL;
@@ -243,12 +234,10 @@ namespace mongo {
while ( _cursor->more() ) {
_next = _cursor->next();
- if ( _matcher.matches( _next ) ) {
- if ( ! _cursor->moreInCurrentBatch() )
- _next = _next.getOwned();
- return;
+ if (!_cursor->moreInCurrentBatch()) {
+ _next = _next.getOwned();
}
- _next = BSONObj();
+ return;
}
_done = true;
}
diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h
index b75ef115dc9..87c40526882 100644
--- a/src/mongo/client/parallel.h
+++ b/src/mongo/client/parallel.h
@@ -258,9 +258,7 @@ namespace mongo {
// TODO: We probably don't really need this as a separate class.
class MONGO_CLIENT_API FilteringClientCursor {
public:
- FilteringClientCursor( const BSONObj filter = BSONObj() );
- FilteringClientCursor( DBClientCursor* cursor , const BSONObj filter = BSONObj() );
- FilteringClientCursor( auto_ptr<DBClientCursor> cursor , const BSONObj filter = BSONObj() );
+ FilteringClientCursor();
~FilteringClientCursor();
void reset( auto_ptr<DBClientCursor> cursor );
@@ -283,7 +281,6 @@ namespace mongo {
private:
void _advance();
- Matcher _matcher;
auto_ptr<DBClientCursor> _cursor;
ParallelConnectionMetadata* _pcmData;
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 47ea2b82e11..5fd15c916b7 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -1205,7 +1205,8 @@ namespace mongo {
if ( !status.isOK() ) {
problem() << "Couldn't unindex record " << obj.toString()
- << " status: " << status.toString();
+ << " from collection " << _collection->ns()
+ << ". Status: " << status.toString();
}
return Status::OK();
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 00fb0cd9762..b36b9ce6914 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -124,14 +124,6 @@ namespace mongo {
Timer startupSrandTimer;
- const char *ourgetns() {
- Client *c = currentClient.get();
- if ( ! c )
- return "";
- Client::Context* cc = c->getContext();
- return cc ? cc->ns() : "";
- }
-
struct MyStartupTests {
MyStartupTests() {
verify( sizeof(OID) == 12 );
@@ -968,8 +960,6 @@ static int mongoDbMain(int argc, char* argv[], char **envp) {
mongo::reportEventToSystem = &mongo::reportEventToSystemImpl;
#endif
- getcurns = ourgetns;
-
setupSignalHandlers();
dbExecCommand = argv[0];
diff --git a/src/mongo/db/ops/delete_executor.cpp b/src/mongo/db/ops/delete_executor.cpp
index 79d7a381434..248e240fd9f 100644
--- a/src/mongo/db/ops/delete_executor.cpp
+++ b/src/mongo/db/ops/delete_executor.cpp
@@ -171,7 +171,8 @@ namespace mongo {
if (logop) {
if ( toDelete.isEmpty() ) {
- problem() << "deleted object without id, not logging" << endl;
+ problem() << "Deleted object without id in collection " << collection->ns()
+ << ", not logging.";
}
else {
bool replJustOne = true;
diff --git a/src/mongo/db/query/cached_plan_runner.cpp b/src/mongo/db/query/cached_plan_runner.cpp
index 9b108cecb4b..6a17ffb4aa7 100644
--- a/src/mongo/db/query/cached_plan_runner.cpp
+++ b/src/mongo/db/query/cached_plan_runner.cpp
@@ -181,16 +181,7 @@ namespace mongo {
return;
}
- // We need to check db and collection for NULL because updateCache() is called upon destruction of
- // the CachedPlanRunner. In some cases, the db or collection could be dropped without kill()
- // being called on the runner (for example, timeout of a ClientCursor holding the runner).
- // XXX - this whole thing is odd
- Database* db = cc().getContext()->db();
- if (NULL == db) { return; }
- Collection* collection = db->getCollection(_canonicalQuery->ns());
- if (NULL == collection) { return; }
- invariant( collection == _collection );
- PlanCache* cache = collection->infoCache()->getPlanCache();
+ PlanCache* cache = _collection->infoCache()->getPlanCache();
std::auto_ptr<PlanCacheEntryFeedback> feedback(new PlanCacheEntryFeedback());
feedback->stats.reset(_exec->getStats());
diff --git a/src/mongo/db/query/multi_plan_runner.cpp b/src/mongo/db/query/multi_plan_runner.cpp
index 9fe4f28e04a..b544efa1e23 100644
--- a/src/mongo/db/query/multi_plan_runner.cpp
+++ b/src/mongo/db/query/multi_plan_runner.cpp
@@ -294,11 +294,7 @@ namespace mongo {
// cached plan runner to fall back on a different solution
// if the best solution fails. Alternatively we could try to
// defer cache insertion to be after the first produced result.
- Database* db = cc().getContext()->db();
- verify(NULL != db);
- Collection* collection = db->getCollection(_query->ns());
- verify(NULL != collection);
- PlanCache* cache = collection->infoCache()->getPlanCache();
+ PlanCache* cache = _collection->infoCache()->getPlanCache();
cache->remove(*_query);
// Move the backup info into the bestPlan info and clear the backup
@@ -401,11 +397,7 @@ namespace mongo {
const PlanStageStats* bestStats = _ranking->stats.vector()[0];
if (PlanCache::shouldCacheQuery(*_query)
&& (!_alreadyProduced.empty() || bestStats->common.isEOF)) {
- Database* db = cc().getContext()->db();
- verify(NULL != db);
- Collection* collection = db->getCollection(_query->ns());
- verify(NULL != collection);
- PlanCache* cache = collection->infoCache()->getPlanCache();
+ PlanCache* cache = _collection->infoCache()->getPlanCache();
// Create list of candidate solutions for the cache with
// the best solution at the front.
std::vector<QuerySolution*> solutions;
diff --git a/src/mongo/db/structure/btree/btree_logic.cpp b/src/mongo/db/structure/btree/btree_logic.cpp
index 4032041798f..dfc1105f530 100644
--- a/src/mongo/db/structure/btree/btree_logic.cpp
+++ b/src/mongo/db/structure/btree/btree_logic.cpp
@@ -577,7 +577,7 @@ namespace mongo {
invariant( foo >= 0 );
}
setPacked(bucket);
- assertValid(bucket, _ordering);
+ assertValid(_indexName, bucket, _ordering);
}
template <class BtreeLayout>
@@ -1795,7 +1795,7 @@ namespace mongo {
if (found) {
BucketType* bucket = btreemod(trans, getBucket(loc));
delKeyAtPos(trans, bucket, loc, pos);
- assertValid(getRoot(), _ordering);
+ assertValid(_indexName, getRoot(), _ordering);
}
return found;
}
@@ -1935,7 +1935,7 @@ namespace mongo {
pushBack(r, kn.recordLoc, kn.data, kn.prevChildBucket);
}
r->nextChild = bucket->nextChild;
- assertValid(r, _ordering);
+ assertValid(_indexName, r, _ordering);
r = NULL;
fixParentPtrs(trans, getBucket(rLoc), rLoc);
@@ -1953,7 +1953,7 @@ namespace mongo {
BucketType* p = btreemod(trans, getBucket(L));
pushBack(p, splitkey.recordLoc, splitkey.data, bucketLoc);
p->nextChild = rLoc;
- assertValid(p, _ordering);
+ assertValid(_indexName, p, _ordering);
bucket->parent = L;
_headManager->setHead(L);
*trans->writing(&getBucket(rLoc)->parent) = bucket->parent;
@@ -2084,7 +2084,7 @@ namespace mongo {
bool dumpBuckets,
unsigned depth) {
BucketType* bucket = getBucket(bucketLoc);
- assertValid(bucket, _ordering, true);
+ assertValid(_indexName, bucket, _ordering, true);
if (dumpBuckets) {
log() << bucketLoc.toString() << ' ';
@@ -2138,9 +2138,10 @@ namespace mongo {
// static
template <class BtreeLayout>
- void BtreeLogic<BtreeLayout>::assertValid(BucketType* bucket,
- const Ordering& ordering,
- bool force) {
+ void BtreeLogic<BtreeLayout>::assertValid(const std::string& ns,
+ BucketType* bucket,
+ const Ordering& ordering,
+ bool force) {
if (!force) {
return;
}
@@ -2190,7 +2191,7 @@ namespace mongo {
int z = k1.data.woCompare(k2.data, ordering);
//wassert( z <= 0 );
if (z > 0) {
- problem() << "btree keys out of order" << '\n';
+ problem() << "Btree keys out of order in collection " << ns;
ONCE {
dump(bucket);
}
@@ -2223,7 +2224,7 @@ namespace mongo {
DiskLoc(),
DiskLoc());
- assertValid(getRoot(), _ordering);
+ assertValid(_indexName, getRoot(), _ordering);
return status;
}
diff --git a/src/mongo/db/structure/btree/btree_logic.h b/src/mongo/db/structure/btree/btree_logic.h
index a003796f2fb..f15a41bb84c 100644
--- a/src/mongo/db/structure/btree/btree_logic.h
+++ b/src/mongo/db/structure/btree/btree_logic.h
@@ -293,7 +293,10 @@ namespace mongo {
static void dump(BucketType* bucket, int depth = 0);
- static void assertValid(BucketType* bucket, const Ordering& ordering, bool force = false);
+ static void assertValid(const std::string& ns,
+ BucketType* bucket,
+ const Ordering& ordering,
+ bool force = false);
//
// 'this'-specific helpers (require record store, catalog information, or ordering, or type
diff --git a/src/mongo/db/structure/record_store_v1_simple.cpp b/src/mongo/db/structure/record_store_v1_simple.cpp
index 85ec3bff441..f95e1c90f2b 100644
--- a/src/mongo/db/structure/record_store_v1_simple.cpp
+++ b/src/mongo/db/structure/record_store_v1_simple.cpp
@@ -100,7 +100,8 @@ namespace mongo {
int fileOffset = cur.getOfs();
if (fileNumber < -1 || fileNumber >= 100000 || fileOffset < 0) {
StringBuilder sb;
- sb << "Deleted record list corrupted in bucket " << b
+ sb << "Deleted record list corrupted in collection " << _ns
+ << ", bucket " << b
<< ", link number " << chain
<< ", invalid link is " << cur.toString()
<< ", throwing Fatal Assertion";
diff --git a/src/mongo/util/log.cpp b/src/mongo/util/log.cpp
index 84fc1399c21..6199d61a8f7 100644
--- a/src/mongo/util/log.cpp
+++ b/src/mongo/util/log.cpp
@@ -56,9 +56,6 @@ namespace mongo {
int tlogLevel = 0; // test log level. so we avoid overchattiness (somewhat) in the c++ unit tests
- const char *default_getcurns() { return ""; }
- const char * (*getcurns)() = default_getcurns;
-
bool rotateLogs() {
using logger::RotatableFileManager;
RotatableFileManager* manager = logger::globalRotatableFileManager();
diff --git a/src/mongo/util/log.h b/src/mongo/util/log.h
index bba73ff29c0..6219b3c5d45 100644
--- a/src/mongo/util/log.h
+++ b/src/mongo/util/log.h
@@ -98,12 +98,8 @@ namespace logger {
if ((!::mongo::debug && ((DLEVEL) > tlogLevel)) || !::mongo::logger::globalLogDomain()->shouldLog(::mongo::LogstreamBuilder::severityCast(DLEVEL))) {} \
else LogstreamBuilder(::mongo::logger::globalLogDomain(), getThreadName(), ::mongo::LogstreamBuilder::severityCast(DLEVEL))
- /* default impl returns "" -- mongod overrides */
- extern const char * (*getcurns)();
-
inline LogstreamBuilder problem() {
- std::string curns = getcurns();
- return log().setBaseMessage(curns);
+ return log();
}
/**
diff --git a/src/mongo/util/mmap_posix.cpp b/src/mongo/util/mmap_posix.cpp
index 9f661516d1a..7c015e2fc1b 100644
--- a/src/mongo/util/mmap_posix.cpp
+++ b/src/mongo/util/mmap_posix.cpp
@@ -242,7 +242,8 @@ namespace mongo {
return;
if ( msync(viewForFlushing(), len, sync ? MS_SYNC : MS_ASYNC) ) {
// msync failed, this is very bad
- problem() << "msync failed: " << errnoWithDescription();
+ problem() << "msync failed: " << errnoWithDescription()
+ << " file: " << filename() << endl;
dataSyncFailedHandler();
}
}