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

print filename for windows flush failure SERVER-1107

This commit is contained in:
Eliot Horowitz 2010-05-10 11:26:08 -04:00
parent 7728b70838
commit f20f5b76f1
3 changed files with 8 additions and 5 deletions

View File

@ -113,6 +113,7 @@ namespace mongo {
HANDLE maphandle;
void *view;
long len;
string _filename;
};
void printMemInfo( const char * where );

View File

@ -51,6 +51,7 @@ namespace mongo {
void* MemoryMappedFile::map(const char *filename, long &length, int options) {
// length may be updated by callee.
_filename = filename;
theFileAllocator().allocateAsap( filename, length );
len = length;

View File

@ -46,13 +46,14 @@ namespace mongo {
buf << s;
return buf.str();
}
unsigned mapped = 0;
void* MemoryMappedFile::map(const char *_filename, long &length, int options) {
void* MemoryMappedFile::map(const char *filenameIn, long &length, int options) {
_filename = filenameIn;
/* big hack here: Babble uses db names with colons. doesn't seem to work on windows. temporary perhaps. */
char filename[256];
strncpy(filename, _filename, 255);
strncpy(filename, filenameIn, 255);
filename[255] = 0;
{
size_t len = strlen( filename );
@ -107,13 +108,13 @@ namespace mongo {
bool success = FlushViewOfFile(view, 0); // 0 means whole mapping
if (!success){
int err = GetLastError();
out() << "FlushViewOfFile failed " << err << endl;
out() << "FlushViewOfFile failed " << err << " file: " << _filename << endl;
}
success = FlushFileBuffers(fd);
if (!success){
int err = GetLastError();
out() << "FlushFileBuffers failed " << err << endl;
out() << "FlushFileBuffers failed " << err << " file: " << _filename << endl;
}
}
}