diff -Nru mongodb-1.4.3/db/concurrency.h mongodb-1.4.4/db/concurrency.h --- mongodb-1.4.3/db/concurrency.h 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/concurrency.h 2010-06-30 09:03:29.000000000 +0200 @@ -113,16 +113,26 @@ bool atLeastReadLocked() { return _state.get() != 0; } void assertAtLeastReadLocked() { assert(atLeastReadLocked()); } - void lock() { + bool _checkWriteLockAlready(){ //DEV cout << "LOCK" << endl; DEV assert( haveClient() ); int s = _state.get(); if( s > 0 ) { _state.set(s+1); - return; + return true; } + massert( 10293 , (string)"internal error: locks are not upgradeable: " + sayClientState() , s == 0 ); + + return false; + } + + void lock() { + + if ( _checkWriteLockAlready() ) + return; + _state.set(1); curopWaitingForLock( 1 ); @@ -131,6 +141,26 @@ _minfo.entered(); } + + bool lock_try() { + if ( _checkWriteLockAlready() ) + return true; + + curopWaitingForLock( 1 ); + + boost::system_time until = get_system_time(); + until += boost::posix_time::milliseconds(0); + bool got = _m.timed_lock( until ); + curopGotLock(); + + if ( got ){ + _minfo.entered(); + _state.set(1); + } + + return got; + } + void unlock() { //DEV cout << "UNLOCK" << endl; int s = _state.get(); @@ -227,12 +257,18 @@ void lock() { #ifdef HAVE_READLOCK m.lock(); +#error this should be impossible? #else boost::detail::thread::lock_ops::lock(m); #endif _minfo.entered(); } + bool lock_try(){ + lock(); + return true; + } + void releaseEarly() { assertWriteLocked(); // aso must not be recursive, although we don't verify that in the old boost version assert( !_releasedEarly.get() ); @@ -326,6 +362,23 @@ } bool _got; }; + + struct writelocktry { + writelocktry( const string&ns ){ + _got = dbMutex.lock_try(); + } + ~writelocktry() { + if ( _got ){ + dbunlocking_write(); + dbMutex.unlock(); + } + } + bool got(){ + return _got; + } + bool _got; + }; + struct atleastreadlock { atleastreadlock( const string& ns ){ diff -Nru mongodb-1.4.3/db/database.h mongodb-1.4.4/db/database.h --- mongodb-1.4.3/db/database.h 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/database.h 2010-06-30 09:03:29.000000000 +0200 @@ -154,7 +154,7 @@ return preallocateOnly ? 0 : p; } - MongoDataFile* addAFile( int sizeNeeded = 0, bool preallocateNextFile = false ) { + MongoDataFile* addAFile( int sizeNeeded, bool preallocateNextFile ) { int n = (int) files.size(); MongoDataFile *ret = getFile( n, sizeNeeded ); if ( preallocateNextFile ) @@ -168,12 +168,15 @@ getFile( n, 0, true ); } - MongoDataFile* suitableFile( int sizeNeeded ) { + MongoDataFile* suitableFile( int sizeNeeded, bool preallocate ) { MongoDataFile* f = newestFile(); + if ( !f ) { + f = addAFile( sizeNeeded, preallocate ); + } for ( int i = 0; i < 8; i++ ) { if ( f->getHeader()->unusedLength >= sizeNeeded ) break; - f = addAFile( sizeNeeded ); + f = addAFile( sizeNeeded, preallocate ); if ( f->getHeader()->fileLength >= MongoDataFile::maxSize() ) // this is as big as they get so might as well stop break; } @@ -183,12 +186,16 @@ Extent* allocExtent( const char *ns, int size, bool capped ) { Extent *e = DataFileMgr::allocFromFreeList( ns, size, capped ); if( e ) return e; - return suitableFile( size )->createExtent( ns, size, capped ); + return suitableFile( size, !capped )->createExtent( ns, size, capped ); } MongoDataFile* newestFile() { int n = (int) files.size(); - if ( n > 0 ) n--; + if ( n > 0 ) { + n--; + } else { + return 0; + } return getFile(n); } diff -Nru mongodb-1.4.3/db/db.cpp mongodb-1.4.4/db/db.cpp --- mongodb-1.4.3/db/db.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/db.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -193,22 +193,22 @@ LastError *le = new LastError(); lastError.reset(le); - MessagingPort& dbMsgPort = *connGrab; + auto_ptr dbMsgPort( connGrab ); connGrab = 0; Client& c = cc(); try { - c.getAuthenticationInfo()->isLocalHost = dbMsgPort.farEnd.isLocalHost(); + c.getAuthenticationInfo()->isLocalHost = dbMsgPort->farEnd.isLocalHost(); Message m; while ( 1 ) { m.reset(); - if ( !dbMsgPort.recv(m) ) { + if ( !dbMsgPort->recv(m) ) { if( !cmdLine.quiet ) - log() << "end connection " << dbMsgPort.farEnd.toString() << endl; - dbMsgPort.shutdown(); + log() << "end connection " << dbMsgPort->farEnd.toString() << endl; + dbMsgPort->shutdown(); break; } @@ -220,11 +220,11 @@ lastError.startRequest( m , le ); DbResponse dbresponse; - if ( !assembleResponse( m, dbresponse, dbMsgPort.farEnd.sa ) ) { - out() << curTimeMillis() % 10000 << " end msg " << dbMsgPort.farEnd.toString() << endl; + if ( !assembleResponse( m, dbresponse, dbMsgPort->farEnd.sa ) ) { + out() << curTimeMillis() % 10000 << " end msg " << dbMsgPort->farEnd.toString() << endl; /* todo: we may not wish to allow this, even on localhost: very low priv accounts could stop us. */ - if ( dbMsgPort.farEnd.isLocalHost() ) { - dbMsgPort.shutdown(); + if ( dbMsgPort->farEnd.isLocalHost() ) { + dbMsgPort->shutdown(); sleepmillis(50); problem() << "exiting end msg" << endl; dbexit(EXIT_CLEAN); @@ -235,17 +235,17 @@ } if ( dbresponse.response ) - dbMsgPort.reply(m, *dbresponse.response, dbresponse.responseTo); + dbMsgPort->reply(m, *dbresponse.response, dbresponse.responseTo); } } catch ( AssertionException& ) { problem() << "AssertionException in connThread, closing client connection" << endl; - dbMsgPort.shutdown(); + dbMsgPort->shutdown(); } catch ( SocketException& ) { problem() << "SocketException in connThread, closing client connection" << endl; - dbMsgPort.shutdown(); + dbMsgPort->shutdown(); } catch ( const ClockSkewException & ) { exitCleanly( EXIT_CLOCK_SKEW ); diff -Nru mongodb-1.4.3/db/instance.cpp mongodb-1.4.4/db/instance.cpp --- mongodb-1.4.3/db/instance.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/instance.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -96,11 +96,13 @@ scoped_lock bl(Client::clientsMutex); for( set::iterator i = Client::clients.begin(); i != Client::clients.end(); i++ ) { Client *c = *i; + assert( c ); if ( c == &me ) continue; - CurOp& co = *(c->curop()); - if( all || co.active() ) - vals.push_back( co.infoNoauth() ); + CurOp* co = c->curop(); + assert( co ); + if( all || co->active() ) + vals.push_back( co->infoNoauth() ); } } b.append("inprog", vals); diff -Nru mongodb-1.4.3/db/pdfile.cpp mongodb-1.4.4/db/pdfile.cpp --- mongodb-1.4.3/db/pdfile.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/pdfile.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -197,7 +197,7 @@ // $nExtents is just for testing - always allocate new extents // rather than reuse existing extents so we have some predictibility // in the extent size used by our tests - database->suitableFile( (int) size )->createExtent( ns, (int) size, newCapped ); + database->suitableFile( (int) size, false )->createExtent( ns, (int) size, newCapped ); } } else { while ( size > 0 ) { @@ -206,11 +206,6 @@ Extent *e = database->allocExtent( ns, desiredExtentSize, newCapped ); size -= e->length; } - if ( !newCapped ) { - // check if it's time to preallocate a new file, and if so queue that job for a bg thread - // safe to call this multiple times - the implementation will only preallocate one file - database->preallocateAFile(); - } } NamespaceDetails *d = nsdetails(ns); @@ -1537,7 +1532,9 @@ assumes ns is capped and no indexes */ Record* DataFileMgr::fast_oplog_insert(NamespaceDetails *d, const char *ns, int len) { + assert( d ); RARELY assert( d == nsdetails(ns) ); + DEV assert( d == nsdetails(ns) ); DiskLoc extentLoc; int lenWHdr = len + Record::HeaderSize; diff -Nru mongodb-1.4.3/db/repl.cpp mongodb-1.4.4/db/repl.cpp --- mongodb-1.4.3/db/repl.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/repl.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -1720,22 +1720,21 @@ sleepsecs(4); Client::initThread("replmaster"); while( 1 ) { - { - dblock lk; - cc().getAuthenticationInfo()->authorize("admin"); - } sleepsecs(10); /* write a keep-alive like entry to the log. this will make things like printReplicationStatus() and printSlaveReplicationStatus() stay up-to-date even when things are idle. */ { - writelock lk(""); - try { - logKeepalive(); - } - catch(...) { - log() << "caught exception in replMasterThread()" << endl; + writelocktry lk(""); + if ( lk.got() ){ + cc().getAuthenticationInfo()->authorize("admin"); + try { + logKeepalive(); + } + catch(...) { + log() << "caught exception in replMasterThread()" << endl; + } } } } diff -Nru mongodb-1.4.3/db/stats/top.cpp mongodb-1.4.4/db/stats/top.cpp --- mongodb-1.4.3/db/stats/top.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/stats/top.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -99,7 +99,7 @@ case opReply: case dbMsg: case dbKillCursors: - log() << "unexpected op in Top::record: " << op << endl; + //log() << "unexpected op in Top::record: " << op << endl; break; default: log() << "unknown op in Top::record: " << op << endl; diff -Nru mongodb-1.4.3/db/update.cpp mongodb-1.4.4/db/update.cpp --- mongodb-1.4.3/db/update.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/update.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -67,7 +67,7 @@ ms.incint = elt.numberInt() + in.numberInt(); } - ms.appendIncValue( bb ); + ms.appendIncValue( bb , false ); } template< class Builder > diff -Nru mongodb-1.4.3/db/update.h mongodb-1.4.4/db/update.h --- mongodb-1.4.3/db/update.h 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/db/update.h 2010-06-30 09:03:29.000000000 +0200 @@ -413,7 +413,7 @@ void appendForOpLog( BSONObjBuilder& b ) const { if ( incType ){ BSONObjBuilder bb( b.subobjStart( "$set" ) ); - appendIncValue( bb ); + appendIncValue( bb , true ); bb.done(); return; } @@ -434,14 +434,16 @@ } template< class Builder > - void appendIncValue( Builder& b ) const { + void appendIncValue( Builder& b , bool useFullName ) const { + const char * n = useFullName ? m->fieldName : m->shortFieldName; + switch ( incType ){ case NumberDouble: - b.append( m->shortFieldName , incdouble ); break; + b.append( n , incdouble ); break; case NumberLong: - b.append( m->shortFieldName , inclong ); break; + b.append( n , inclong ); break; case NumberInt: - b.append( m->shortFieldName , incint ); break; + b.append( n , incint ); break; default: assert(0); } diff -Nru mongodb-1.4.3/debian/changelog mongodb-1.4.4/debian/changelog --- mongodb-1.4.3/debian/changelog 2010-06-11 07:12:28.000000000 +0200 +++ mongodb-1.4.4/debian/changelog 2010-07-14 15:53:24.000000000 +0200 @@ -1,3 +1,29 @@ +mongodb (1:1.4.4-2ubuntu1) maverick; urgency=low + + * Merge from debian unstable (LP: #605383). Remaining changes: + - debian/mongodb-server.mongodb.upstart: add upstart job. + - Add dependency on xulrunner-1.9.2 since mongodb requires libmozjs.so. + - Mark mongodb-{server,client,dev} as replacing mongodb to be able to + upgrade from Lucid. + + -- Angel Abad Sat, 10 Jul 2010 06:40:58 +0100 + +mongodb (1:1.4.4-2) unstable; urgency=low + + * [3bd69dc] install libs to /usr/lib not /usr/lib64 (Closes: #588557) + + -- Antonin Kral Fri, 09 Jul 2010 21:26:05 +0200 + +mongodb (1:1.4.4-1) unstable; urgency=low + + * [5c6a221] Imported Upstream version 1.4.4 + * upstream change log is at + http://jira.mongodb.org/browse/SERVER/fixforversion/10166 + * [68c73c3] removed not needed files from upstream + * [c1546df] debian policy to 3.9.0 + + -- Antonin Kral Wed, 30 Jun 2010 09:32:45 +0200 + mongodb (1:1.4.3-2ubuntu1) maverick; urgency=low [ Clint Byrum ] diff -Nru mongodb-1.4.3/debian/control mongodb-1.4.4/debian/control --- mongodb-1.4.3/debian/control 2010-06-11 07:12:28.000000000 +0200 +++ mongodb-1.4.4/debian/control 2010-07-14 15:54:58.000000000 +0200 @@ -4,7 +4,7 @@ Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Antonin Kral Build-Depends: debhelper (>= 7), libpcre3, libpcre3-dev, scons, xulrunner-dev (>= 1.9) | xulrunner-1.9-dev | xulrunner-1.9.1-dev, libboost1.42-dev | libboost1.40-dev | libboost1.35-dev | libboost1.37-dev | libboost1.38-dev, libboost-thread1.42-dev | libboost-thread1.40-dev | libboost-thread1.38-dev | libboost-thread1.37-dev | libboost-thread1.35-dev, libboost-filesystem1.42-dev | libboost-filesystem1.40-dev | libboost-filesystem1.38-dev | libboost-filesystem1.37-dev | libboost-filesystem1.35-dev, libboost-program-options1.42-dev | libboost-program-options1.40-dev | libboost-program-options1.38-dev | libboost-program-options1.37-dev | libboost-program-options1.35-dev, libboost-date-time1.42-dev | libboost-date-time1.40-dev | libboost-date-time1.38-dev | libboost-date-time1.37-dev | libboost-date-time1.35-dev -Standards-Version: 3.8.4 +Standards-Version: 3.9.0 Homepage: http://www.mongodb.org Package: mongodb @@ -34,7 +34,7 @@ Architecture: i386 amd64 Depends: mongodb-clients, ${shlibs:Depends}, ${misc:Depends}, adduser, xulrunner-1.9.2 -Replaces: mongodb (< 1:1.4.2-2) +Replaces: mongodb (<= 1:1.4.2-2) Description: An object/document-oriented database (server package) MongoDB is a high-performance, open source, schema-free document-oriented data store that's easy to deploy, manage @@ -58,7 +58,7 @@ Package: mongodb-clients Architecture: i386 amd64 Depends: ${shlibs:Depends}, ${misc:Depends} -Replaces: mongodb (< 1:1.4.2-2) +Replaces: mongodb (<= 1:1.4.2-2) Description: An object/document-oriented database (client apps) MongoDB is a high-performance, open source, schema-free document-oriented data store that's easy to deploy, manage @@ -83,7 +83,7 @@ Section: libdevel Architecture: i386 amd64 Depends: mongodb-server, ${shlibs:Depends}, ${misc:Depends} -Replaces: mongodb (< 1:1.4.2-2) +Replaces: mongodb (<= 1:1.4.2-2) Description: An object/document-oriented database (development) MongoDB is a high-performance, open source, schema-free document-oriented data store that's easy to deploy, manage diff -Nru mongodb-1.4.3/debian/mongodb-dev.dirs mongodb-1.4.4/debian/mongodb-dev.dirs --- mongodb-1.4.3/debian/mongodb-dev.dirs 2010-06-11 07:12:28.000000000 +0200 +++ mongodb-1.4.4/debian/mongodb-dev.dirs 2010-07-10 07:40:57.000000000 +0200 @@ -1,2 +1,2 @@ usr/include -usr/lib64 +usr/lib diff -Nru mongodb-1.4.3/debian/mongodb-dev.install mongodb-1.4.4/debian/mongodb-dev.install --- mongodb-1.4.3/debian/mongodb-dev.install 2010-06-11 07:12:28.000000000 +0200 +++ mongodb-1.4.4/debian/mongodb-dev.install 2010-07-10 07:40:58.000000000 +0200 @@ -1,2 +1,2 @@ usr/include -usr/lib* +usr/lib diff -Nru mongodb-1.4.3/debian/patches/debian-changes-1:1.4.3-2 mongodb-1.4.4/debian/patches/debian-changes-1:1.4.3-2 --- mongodb-1.4.3/debian/patches/debian-changes-1:1.4.3-2 2010-06-11 07:12:28.000000000 +0200 +++ mongodb-1.4.4/debian/patches/debian-changes-1:1.4.3-2 1970-01-01 01:00:00.000000000 +0100 @@ -1,57 +0,0 @@ -Description: Upstream changes introduced in version 1:1.4.3-2 - This patch has been created by dpkg-source during the package build. - Here's the last changelog entry, hopefully it gives details on why - those changes were made: - . - mongodb (1:1.4.3-2) unstable; urgency=low - . - * [64bca3c] Updated copyright information as requested by Richard - Kreuter - . - The person named in the Author field signed this changelog entry. -Author: Antonin Kral - ---- -The information above should follow the Patch Tagging Guidelines, please -checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here -are templates for supplementary fields that you might want to add: - -Origin: , -Bug: -Bug-Debian: http://bugs.debian.org/ -Bug-Ubuntu: https://launchpad.net/bugs/ -Forwarded: -Reviewed-By: -Last-Update: - ---- mongodb-1.4.3.orig/SConstruct -+++ mongodb-1.4.3/SConstruct -@@ -1213,15 +1213,15 @@ def ensureDir( name ): - Exit( 1 ) - - def ensureTestDirs(): -- ensureDir( "/tmp/unittest/" ) -- ensureDir( "/data/" ) -- ensureDir( "/data/db/" ) -+ ensureDir( installDir + "/tmp/unittest/" ) -+ ensureDir( installDir + "/data/" ) -+ ensureDir( installDir + "/data/db/" ) - - def testSetup( env , target , source ): - ensureTestDirs() - - if len( COMMAND_LINE_TARGETS ) == 1 and str( COMMAND_LINE_TARGETS[0] ) == "test": -- ensureDir( "/tmp/unittest/" ); -+ ensureDir( installDir + "/tmp/unittest/" ); - - addSmoketest( "smoke", [ add_exe( "test" ) ] , [ test[ 0 ].abspath ] ) - addSmoketest( "smokePerf", [ "perftest" ] , [ perftest[ 0 ].abspath ] ) -@@ -1299,7 +1299,7 @@ def startMongodWithArgs(*args): - mongodForTestsPort = "32000" - import os - ensureTestDirs() -- dirName = "/data/db/sconsTests/" -+ dirName = installDir + "/data/db/sconsTests/" - ensureDir( dirName ) - from subprocess import Popen - mongodForTests = Popen([mongod[0].abspath, "--port", mongodForTestsPort, diff -Nru mongodb-1.4.3/debian/patches/debian-changes-1:1.4.4-2 mongodb-1.4.4/debian/patches/debian-changes-1:1.4.4-2 --- mongodb-1.4.3/debian/patches/debian-changes-1:1.4.4-2 1970-01-01 01:00:00.000000000 +0100 +++ mongodb-1.4.4/debian/patches/debian-changes-1:1.4.4-2 2010-07-09 21:27:26.000000000 +0200 @@ -0,0 +1,66 @@ +Description: Upstream changes introduced in version 1:1.4.4-2 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + mongodb (1:1.4.4-2) unstable; urgency=low + . + * [3bd69dc] install libs to /usr/lib not /usr/lib64 (Closes: #588557) + . + The person named in the Author field signed this changelog entry. +Author: Antonin Kral +Bug-Debian: http://bugs.debian.org/588557 + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- mongodb-1.4.4.orig/SConstruct ++++ mongodb-1.4.4/SConstruct +@@ -510,7 +510,7 @@ elif "linux2" == os.sys.platform: + if os.uname()[4] == "x86_64" and not force32: + linux64 = True + javaVersion = "amd64" +- nixLibPrefix = "lib64" ++ nixLibPrefix = "lib" + env.Append( LIBPATH=["/usr/lib64" , "/lib64" ] ) + env.Append( LIBS=["pthread"] ) + +@@ -1229,15 +1229,15 @@ def ensureDir( name ): + Exit( 1 ) + + def ensureTestDirs(): +- ensureDir( "/tmp/unittest/" ) +- ensureDir( "/data/" ) +- ensureDir( "/data/db/" ) ++ ensureDir( installDir + "/tmp/unittest/" ) ++ ensureDir( installDir + "/data/" ) ++ ensureDir( installDir + "/data/db/" ) + + def testSetup( env , target , source ): + ensureTestDirs() + + if len( COMMAND_LINE_TARGETS ) == 1 and str( COMMAND_LINE_TARGETS[0] ) == "test": +- ensureDir( "/tmp/unittest/" ); ++ ensureDir( installDir + "/tmp/unittest/" ); + + addSmoketest( "smoke", [ add_exe( "test" ) ] , [ test[ 0 ].abspath ] ) + addSmoketest( "smokePerf", [ "perftest" ] , [ perftest[ 0 ].abspath ] ) +@@ -1315,7 +1315,7 @@ def startMongodWithArgs(*args): + mongodForTestsPort = "32000" + import os + ensureTestDirs() +- dirName = "/data/db/sconsTests/" ++ dirName = installDir + "/data/db/sconsTests/" + ensureDir( dirName ) + from subprocess import Popen + mongodForTests = Popen([mongod[0].abspath, "--port", mongodForTestsPort, diff -Nru mongodb-1.4.3/debian/patches/series mongodb-1.4.4/debian/patches/series --- mongodb-1.4.3/debian/patches/series 2010-06-11 07:12:28.000000000 +0200 +++ mongodb-1.4.4/debian/patches/series 2010-07-10 07:40:58.000000000 +0200 @@ -1 +1 @@ -debian-changes-1:1.4.3-2 +debian-changes-1:1.4.4-2 diff -Nru mongodb-1.4.3/doxygenConfig mongodb-1.4.4/doxygenConfig --- mongodb-1.4.3/doxygenConfig 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/doxygenConfig 2010-06-30 09:03:29.000000000 +0200 @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = MongoDB -PROJECT_NUMBER = 1.4.3 +PROJECT_NUMBER = 1.4.4 OUTPUT_DIRECTORY = docs CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English diff -Nru mongodb-1.4.3/jstests/disk/preallocate2.js mongodb-1.4.4/jstests/disk/preallocate2.js --- mongodb-1.4.3/jstests/disk/preallocate2.js 1970-01-01 01:00:00.000000000 +0100 +++ mongodb-1.4.4/jstests/disk/preallocate2.js 2010-06-30 09:03:29.000000000 +0200 @@ -0,0 +1,11 @@ +// check that there is preallocation on insert + +port = allocatePorts( 1 )[ 0 ]; + +var baseName = "jstests_preallocate2"; + +var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName ); + +m.getDB( baseName )[ baseName ].save( {i:1} ); + +assert.soon( function() { return m.getDBs().totalSize > 100000000; }, "expected second file to bring total size over 100MB" ); \ No hay ningún carácter de nueva línea al final del archivo diff -Nru mongodb-1.4.3/jstests/disk/preallocate.js mongodb-1.4.4/jstests/disk/preallocate.js --- mongodb-1.4.3/jstests/disk/preallocate.js 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/jstests/disk/preallocate.js 2010-06-30 09:03:29.000000000 +0200 @@ -1,15 +1,17 @@ -port = allocatePorts( 1 )[ 0 ]; +// check that there is preallocation on explicit createCollection() and no unncessary preallocation after restart -var baseName = "jstests_preallocate"; +port = allocatePorts( 1 )[ 0 ]; -vsize = function() { - return m.getDB( "admin" ).runCommand( "serverStatus" ).mem.virtual; -} +var baseName = "jstests_preallocate2"; var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName ); +assert.eq( 0, m.getDBs().totalSize ); + m.getDB( baseName ).createCollection( baseName + "1" ); +assert.soon( function() { return m.getDBs().totalSize > 100000000; }, "expected second file to bring total size over 100MB" ); + stopMongod( port ); var m = startMongoProgram( "mongod", "--port", port, "--dbpath", "/data/db/" + baseName ); diff -Nru mongodb-1.4.3/jstests/repl/basic1.js mongodb-1.4.4/jstests/repl/basic1.js --- mongodb-1.4.3/jstests/repl/basic1.js 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/jstests/repl/basic1.js 2010-06-30 09:03:29.000000000 +0200 @@ -121,12 +121,30 @@ block(); check( "after pos 4 " ); - printjson( am.rpos.findOne() ) printjson( as.rpos.findOne() ) //am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().limit(10).sort( { $natural : -1 } ).forEach( printjson ) + +t = am.b; +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 6743} } , true, false) +block() +check( "b 1" ); + +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 5} } , true, false) +block() +check( "b 2" ); + +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 100, "a.b.c.y" : 911} } , true, false) +block() +assert.eq( { _id : "fun" , a : { b : { c : { x : 6848 , y : 911 } } } } , as.b.findOne() , "b 3" ); +//printjson( t.findOne() ) +//printjson( as.b.findOne() ) +//am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().sort( { $natural : -1 } ).limit(3).forEach( printjson ) +check( "b 4" ); + + rt.stop(); diff -Nru mongodb-1.4.3/rpm/mongo.spec mongodb-1.4.4/rpm/mongo.spec --- mongodb-1.4.3/rpm/mongo.spec 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/rpm/mongo.spec 2010-06-30 09:03:29.000000000 +0200 @@ -1,5 +1,5 @@ Name: mongo -Version: 1.4.3 +Version: 1.4.4 Release: mongodb_1%{?dist} Summary: mongo client shell and tools License: AGPL 3.0 @@ -68,8 +68,13 @@ rm -rf $RPM_BUILD_ROOT %pre server -/usr/sbin/useradd -M -r -U -d /var/lib/mongo -s /bin/false \ - -c mongod mongod > /dev/null 2>&1 +if ! /usr/bin/id -g mongod &>/dev/null; then + /usr/sbin/groupadd -r mongod +fi +if ! /usr/bin/id mongod &>/dev/null; then + /usr/sbin/useradd -M -r -g mongod -d /var/lib/mongo -s /bin/false \ + -c mongod mongod > /dev/null 2>&1 +fi %post server if test $1 = 1 diff -Nru mongodb-1.4.3/SConstruct mongodb-1.4.4/SConstruct --- mongodb-1.4.3/SConstruct 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/SConstruct 2010-06-30 09:03:29.000000000 +0200 @@ -457,10 +457,13 @@ installDir = GetOption( "prefix" ) def findVersion( root , choices ): - for c in choices: - if ( os.path.exists( root + c ) ): - return root + c - raise "can't find a version of [" + root + "] choices: " + choices + if not isinstance(root, list): + root = [root] + for r in root: + for c in choices: + if ( os.path.exists( r + c ) ): + return r + c + raise RuntimeError("can't find a version of [" + repr(root) + "] choices: " + repr(choices)) def choosePathExist( choices , default=None): for c in choices: @@ -556,13 +559,26 @@ boostDir = "C:/Program Files" + x + "/Boost/boost_1_" + str(bv) + extra if os.path.exists( boostDir ): return boostDir + if os.path.exists( "C:/boost" ): + return "C:/boost" + if os.path.exists( "/boost" ): + return "/boost" return None + boostDir = find_boost() if boostDir is None: print( "can't find boost" ) Exit(1) + if force64 and os.path.exists( boostDir + "/lib/vs2010_64" ): + env.Append( LIBPATH=[ boostDir + "/lib/vs2010_64" ] ) + elif not force64 and os.path.exists( boostDir + "/lib/vs2010_32" ): + env.Append( LIBPATH=[ boostDir + "/lib/vs2010_32" ] ) + else: + env.Append( LIBPATH=[ boostDir + "/Lib" ] ) + + serverOnlyFiles += [ "util/ntservice.cpp" ] boostLibs = [] @@ -579,8 +595,8 @@ env.Append( LIBPATH=[ javaHome + "/Lib" ] ) javaLibs += [ "jvm" ]; - winSDKHome = findVersion( "C:/Program Files/Microsoft SDKs/Windows/" , - [ "v6.0" , "v6.0a" , "v6.1" ] ) + winSDKHome = findVersion( [ "C:/Program Files/Microsoft SDKs/Windows/", "C:/Program Files (x86)/Microsoft SDKs/Windows/" ] , + [ "v6.0" , "v6.0a" , "v6.1", "v7.0A" ] ) env.Append( CPPPATH=[ boostDir , "pcre-7.4" , winSDKHome + "/Include" ] ) diff -Nru mongodb-1.4.3/stdafx.cpp mongodb-1.4.4/stdafx.cpp --- mongodb-1.4.3/stdafx.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/stdafx.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -32,6 +32,6 @@ namespace mongo { - const char versionString[] = "1.4.3"; + const char versionString[] = "1.4.4"; } // namespace mongo diff -Nru mongodb-1.4.3/util/message_server_port.cpp mongodb-1.4.4/util/message_server_port.cpp --- mongodb-1.4.3/util/message_server_port.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/util/message_server_port.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -31,7 +31,7 @@ void threadRun(){ assert( grab ); - MessagingPort * p = grab; + auto_ptr p( grab ); grab = 0; Message m; @@ -45,12 +45,11 @@ break; } - handler->process( m , p ); + handler->process( m , p.get() ); } } catch ( ... ){ problem() << "uncaught exception in PortMessageServer::threadRun, closing connection" << endl; - delete p; } } diff -Nru mongodb-1.4.3/util/ntservice.cpp mongodb-1.4.4/util/ntservice.cpp --- mongodb-1.4.3/util/ntservice.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/util/ntservice.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -111,11 +111,14 @@ SERVICE_STATUS serviceStatus; - // stop service if running + // stop service if its running if ( ::ControlService( schService, SERVICE_CONTROL_STOP, &serviceStatus ) ) { while ( ::QueryServiceStatus( schService, &serviceStatus ) ) { if ( serviceStatus.dwCurrentState == SERVICE_STOP_PENDING ) - Sleep( 1000 ); + { + Sleep( 1000 ); + } + else { break; } } } diff -Nru mongodb-1.4.3/util/processinfo_linux2.cpp mongodb-1.4.4/util/processinfo_linux2.cpp --- mongodb-1.4.3/util/processinfo_linux2.cpp 2010-05-30 10:46:48.000000000 +0200 +++ mongodb-1.4.4/util/processinfo_linux2.cpp 2010-06-30 09:03:29.000000000 +0200 @@ -38,7 +38,13 @@ sprintf( name , "/proc/%d/stat" , pid ); FILE * f = fopen( name , "r"); - + if ( ! f ){ + stringstream ss; + ss << "couldn't open [" << name << "] " << OUTPUT_ERRNO; + string s = ss.str(); + msgasserted( 13276 , s.c_str() ); + } + int found = fscanf(f, "%d %s %c " "%d %d %d %d %d "