mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
dur trace a little better
This commit is contained in:
parent
6dea71aa52
commit
cc66c8abf0
@ -60,8 +60,13 @@ namespace mongo {
|
||||
namespace {
|
||||
using namespace dur;
|
||||
|
||||
#if defined(_DEBUG)
|
||||
const bool DebugValidateMapsMatch = true;
|
||||
const bool DebugCheckLastDeclaredWrite = true;
|
||||
#else
|
||||
const bool DebugValidateMapsMatch = false;
|
||||
const bool DebugCheckLastDeclaredWrite = false;
|
||||
#endif
|
||||
|
||||
CommitJob commitJob;
|
||||
}
|
||||
|
16
db/dur.h
16
db/dur.h
@ -7,12 +7,14 @@
|
||||
|
||||
namespace mongo {
|
||||
|
||||
class DurableInterface {
|
||||
class DurableInterface : boost::noncopyable {
|
||||
protected:
|
||||
DurableInterface() {} // Should only be creating subclasses
|
||||
DurableInterface() {} // Should only be creating by subclasses
|
||||
|
||||
public:
|
||||
/** call during startup so durability module can initialize
|
||||
virtual ~DurableInterface() { assert(!"don't destroy me"); }
|
||||
|
||||
/** call during startup so durability module can initialize
|
||||
throws if fatal error
|
||||
*/
|
||||
virtual void startup() = 0;
|
||||
@ -50,9 +52,9 @@ namespace mongo {
|
||||
*/
|
||||
virtual void* writingAtOffset(void *buf, unsigned ofs, unsigned len) = 0;
|
||||
|
||||
#if defined(_DEBUG)
|
||||
virtual void debugCheckLastDeclaredWrite() = 0;
|
||||
|
||||
virtual ~DurableInterface() { assert(!"don't destroy me"); }
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
// END OF VIRTUAL FUNCTIONS //
|
||||
@ -124,7 +126,9 @@ namespace mongo {
|
||||
void* writingAtOffset(void *buf, unsigned ofs, unsigned len) { return buf; }
|
||||
void declareWriteIntent(void *, unsigned) { }
|
||||
void createdFile(string filename, unsigned long long len) { }
|
||||
#if defined(_DEBUG)
|
||||
void debugCheckLastDeclaredWrite() {}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef _DURABLE
|
||||
@ -134,7 +138,9 @@ namespace mongo {
|
||||
void* writingAtOffset(void *buf, unsigned ofs, unsigned len);
|
||||
void declareWriteIntent(void *, unsigned);
|
||||
void createdFile(string filename, unsigned long long len);
|
||||
#if defined(_DEBUG)
|
||||
void debugCheckLastDeclaredWrite();
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -93,6 +93,9 @@ namespace mongo {
|
||||
|
||||
/** record/note an intent to write */
|
||||
void note(WriteIntent& w) {
|
||||
// TEMP
|
||||
DEV getDur().debugCheckLastDeclaredWrite();
|
||||
|
||||
// from the point of view of the dur module, it would be fine (i think) to only
|
||||
// be read locked here. but must be at least read locked to avoid race with
|
||||
// remapprivateview
|
||||
@ -110,7 +113,18 @@ namespace mongo {
|
||||
turn this on and see what is logged. if you have a copy of its output from before the
|
||||
regression, a simple diff of these lines would tell you a lot likely.
|
||||
*/
|
||||
log() << "DEBUG note write intent " << w.p << ' ' << w.len << endl;
|
||||
#if 1 && defined(_DEBUG)
|
||||
{
|
||||
size_t ofs;
|
||||
MongoMMF *mmf = privateViews._find(w.p, ofs);
|
||||
if( mmf ) {
|
||||
log() << "DEBUG note write intent " << w.p << ' ' << mmf->filename() << " ofs:" << hex << ofs << " len:" << w.len << endl;
|
||||
}
|
||||
else {
|
||||
log() << "DEBUG note write intent " << w.p << ' ' << w.len << " NOT FOUND IN privateViews" << endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// remember intent. we will journal it in a bit
|
||||
_wi._writes.push_back(w);
|
||||
|
Loading…
Reference in New Issue
Block a user