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

log cleanup

This commit is contained in:
dwight 2008-08-02 17:02:41 -04:00
parent bc24777c11
commit 112b19a5d9
4 changed files with 13 additions and 14 deletions

View File

@ -411,7 +411,7 @@ bool userCreateNS(const char *ns, JSObj& j, string& err) {
return false;
}
cout << "create collection " << ns << ' ' << j.toString() << endl;
log() << "create collection " << ns << ' ' << j.toString() << endl;
/* todo: do this only when we have allocated space successfully? or we could insert with a { ok: 0 } field
and then go back and set to ok : 1 after we are done.
@ -1036,15 +1036,15 @@ DiskLoc DataFileMgr::insert(const char *ns, const void *buf, int len, bool god)
// try to create it
string err;
if( !userCreateNS(tabletoidxns, emptyObj, err) ) {
cout << "ERROR: failed to create collection while adding its index. " << tabletoidxns << endl;
problem() << "ERROR: failed to create collection while adding its index. " << tabletoidxns << endl;
return DiskLoc();
}
tableToIndex = nsdetails(tabletoidxns);
cout << "info: creating collection " << tabletoidxns << " on add index\n";
log() << "info: creating collection " << tabletoidxns << " on add index\n";
assert( tableToIndex );
}
if( tableToIndex->nIndexes >= MaxIndexes ) {
cout << "user warning: bad add index attempt, too many indexes for:" << tabletoidxns << endl;
log() << "user warning: bad add index attempt, too many indexes for:" << tabletoidxns << endl;
return DiskLoc();
}
if( tableToIndex->findIndexByName(name) >= 0 ) {

View File

@ -61,7 +61,6 @@ struct TestOpTime {
} testoptime;
int test2() {
TestOpTime t;
return 0;
}
@ -314,7 +313,7 @@ void Source::pullOpLog(DBClientConnection& conn) {
}
else if( t != syncedTo ) {
log() << "pull: t " << t.toString() << " != syncedTo " << syncedTo.toString() << '\n';
log() << " data too stale, halting replication" << endl;
log() << "pull: data too stale, halting replication" << endl;
assert( syncedTo < t );
throw SyncException();
}

View File

@ -148,14 +148,14 @@ void* MemoryMappedFile::map(const char *filename, int length) {
/* make sure the file is the full desired length */
off_t filelen = lseek(fd, 0, SEEK_END);
if( filelen < length ) {
cout << "map: file length=" << (unsigned) filelen << " want:";
cout << length;
cout << endl;
log() << "map: file length=" << (unsigned) filelen << " want:"
<< length
<< endl;
if( filelen != 0 ) {
cout << " failing mapping" << endl;
log() << " failing mapping" << endl;
return 0;
}
cout << " writing file to full length with zeroes..." << endl;
log() << " writing file to full length with zeroes..." << endl;
int z = 8192;
char buf[z];
memset(buf, 0, z);
@ -168,7 +168,7 @@ void* MemoryMappedFile::map(const char *filename, int length) {
write(fd, buf, z);
left -= z;
}
cout << " done" << endl;
log() << " done" << endl;
}
lseek(fd, length, SEEK_SET);
@ -184,7 +184,7 @@ void* MemoryMappedFile::map(const char *filename, int length) {
void MemoryMappedFile::flush(bool sync) {
if( msync(view, len, sync ? MS_SYNC : MS_ASYNC) )
cout << "msync error " << errno << endl;
problem() << "msync error " << errno << endl;
}
#endif

View File

@ -62,7 +62,7 @@ inline void disableNagle(int sock) {
}
inline void prebindOptions( int sock ){
log() << "doing prebind option" << endl;
DEV log() << "doing prebind option" << endl;
int x = 1;
if ( setsockopt( sock , SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)) < 0 )
cout << "Failed to set socket opt, SO_REUSEADDR" << endl;