0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

better logging on a fatal journalingFailure

This commit is contained in:
Dwight 2011-11-16 14:21:47 -05:00
parent 279adb20a0
commit 96eb641a69
3 changed files with 9 additions and 4 deletions

View File

@ -90,7 +90,7 @@ namespace mongo {
(2) make an indicator in the journal dir that something bad happened.
(2b) refuse to do a recovery startup if that is there without manual override.
*/
log() << "journaling error " << msg << endl;
log() << "journaling failure/error: " << msg << endl;
assert(false);
}

View File

@ -49,8 +49,11 @@ namespace mongo {
MongoMMF* findMMF_inlock(void *ptr, size_t &ofs) {
MongoMMF *f = privateViews.find_inlock(ptr, ofs);
if( f == 0 ) {
string s = str::stream() << "view pointer cannot be resolved " << (size_t) ptr;
journalingFailure(s.c_str()); // asserts
error() << "findMMF_inlock failed " << privateViews.numberOfViews_inlock() << endl;
printStackTrace(); // we want a stack trace and the assert below didn't print a trace once in the real world
stringstream ss;
ss << "view pointer cannot be resolved " << hex << (size_t) ptr;
journalingFailure(ss.str().c_str()); // asserts
}
return f;
}

View File

@ -110,7 +110,7 @@ namespace mongo {
public:
PointerToMMF();
/** register view. \
/** register view.
threadsafe
*/
void add(void *view, MongoMMF *f);
@ -133,6 +133,8 @@ namespace mongo {
map<void*,MongoMMF*>::iterator finditer_inlock(void *p) { return _views.upper_bound(p); }
unsigned numberOfViews_inlock() const { return _views.size(); }
private:
mutex _m;
map<void*, MongoMMF*> _views;