summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2009-11-30 11:19:01 -0500
committerDwight <dmerriman@gmail.com>2009-11-30 11:19:01 -0500
commit5c2c7efdfdf0c3d11bea5e82d7a84a1fdfa9f0a9 (patch)
tree8746186d43d148173ab356eb1746c6b2cb7004c5
parent7c5992dbead773a896bfa44a3e1cad37367aeee4 (diff)
parentd7280381dfbc77488186c063012b55e6f809ce8f (diff)
downloadmongo-5c2c7efdfdf0c3d11bea5e82d7a84a1fdfa9f0a9.tar.gz
Merge branch 'master' of git@github.com:mongodb/mongo
-rw-r--r--SConstruct4
-rw-r--r--client/gridfs.cpp2
-rw-r--r--db/jsobj.h2
-rw-r--r--util/mmap.cpp11
-rw-r--r--util/mmap_posix.cpp2
5 files changed, 18 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct
index 5bf7e875408..a55b08f04e3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -639,9 +639,13 @@ def setupBuildInfoFile( outFile ):
'namespace mongo { const char * sysInfo(){ return "' + sysInfo + ' BOOST_LIB_VERSION=" BOOST_LIB_VERSION ; } }',
])
+ contents += '\n';
+
if os.path.exists( outFile ) and open( outFile ).read().strip() == contents.strip():
return
+ contents += '\n';
+
out = open( outFile , 'w' )
out.write( contents )
out.close()
diff --git a/client/gridfs.cpp b/client/gridfs.cpp
index d5bc30f421e..d2f6cce174f 100644
--- a/client/gridfs.cpp
+++ b/client/gridfs.cpp
@@ -70,7 +70,7 @@ namespace mongo {
int chunkNumber = 0;
while (data < end){
- int chunkLen = MIN(DEFAULT_CHUNK_SIZE, end-data);
+ int chunkLen = MIN(DEFAULT_CHUNK_SIZE, (unsigned)(end-data));
Chunk c(idObj, chunkNumber, data, chunkLen);
_client.insert( _chunksNS.c_str() , c._data );
diff --git a/db/jsobj.h b/db/jsobj.h
index 4109ea99f1e..3a45e42d2dc 100644
--- a/db/jsobj.h
+++ b/db/jsobj.h
@@ -1723,7 +1723,7 @@ namespace mongo {
}
inline bool BSONObj::isValid(){
- return objsize() > 0 && objsize() <= 1024 * 1024 * 16 ;
+ return objsize() > 0 && objsize() <= 1024 * 1024 * 8;
}
inline bool BSONObj::getObjectID(BSONElement& e) {
diff --git a/util/mmap.cpp b/util/mmap.cpp
index 11237a74c2f..f3103d0c684 100644
--- a/util/mmap.cpp
+++ b/util/mmap.cpp
@@ -21,13 +21,16 @@
namespace mongo {
set<MemoryMappedFile*> mmfiles;
+ boost::mutex mmmutex;
MemoryMappedFile::~MemoryMappedFile() {
close();
+ boostlock lk( mmmutex );
mmfiles.erase(this);
}
void MemoryMappedFile::created(){
+ boostlock lk( mmmutex );
mmfiles.insert(this);
}
@@ -51,6 +54,7 @@ namespace mongo {
long long MemoryMappedFile::totalMappedLength(){
unsigned long long total = 0;
+ boostlock lk( mmmutex );
for ( set<MemoryMappedFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ )
total += (*i)->length();
@@ -59,9 +63,14 @@ namespace mongo {
int MemoryMappedFile::flushAll( bool sync ){
int num = 0;
+
+ boostlock lk( mmmutex );
for ( set<MemoryMappedFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ){
num++;
- (*i)->flush( sync );
+ MemoryMappedFile * mmf = *i;
+ if ( ! mmf )
+ continue;
+ mmf->flush( sync );
}
return num;
}
diff --git a/util/mmap_posix.cpp b/util/mmap_posix.cpp
index e4487cd1403..4b6d0f5c3f9 100644
--- a/util/mmap_posix.cpp
+++ b/util/mmap_posix.cpp
@@ -77,6 +77,8 @@ namespace mongo {
}
void MemoryMappedFile::flush(bool sync) {
+ if ( view == 0 || fd == 0 )
+ return;
if ( msync(view, len, sync ? MS_SYNC : MS_ASYNC) )
problem() << "msync error " << errno << endl;
}