summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2010-06-30 08:56:42 +0200
committerAntonin Kral <a.kral@bobek.cz>2010-06-30 08:56:42 +0200
commit5c6a2219e6715bd7649c3fd28f58e6fb63d60a25 (patch)
tree1eda5f5ca9bd35190fe499a51119e855774b16c0
parentdf7046adebaeb16716b5a2cebc6f34694f530caf (diff)
downloadmongodb-5c6a2219e6715bd7649c3fd28f58e6fb63d60a25.tar.gz
Imported Upstream version 1.4.4
-rw-r--r--SConstruct28
-rw-r--r--db/concurrency.h57
-rw-r--r--db/database.h17
-rw-r--r--db/db.cpp24
-rw-r--r--db/instance.cpp8
-rw-r--r--db/pdfile.cpp9
-rw-r--r--db/repl.cpp19
-rw-r--r--db/stats/top.cpp2
-rw-r--r--db/update.cpp2
-rw-r--r--db/update.h12
-rw-r--r--debian/changelog14
-rw-r--r--debian/files1
-rw-r--r--debian/mongodb.upstart15
-rw-r--r--debian/preinst37
-rw-r--r--doxygenConfig2
-rw-r--r--jstests/disk/preallocate.js12
-rw-r--r--jstests/disk/preallocate2.js11
-rw-r--r--jstests/repl/basic1.js20
-rw-r--r--lib/libboost_thread-gcc41-mt-d-1_34_1.abin0 -> 692920 bytes
-rw-r--r--rpm/mongo.spec11
-rw-r--r--stdafx.cpp2
-rw-r--r--util/message_server_port.cpp5
-rw-r--r--util/ntservice.cpp7
-rw-r--r--util/processinfo_linux2.cpp8
24 files changed, 251 insertions, 72 deletions
diff --git a/SConstruct b/SConstruct
index 8195f77..65457d2 100644
--- a/SConstruct
+++ b/SConstruct
@@ -457,10 +457,13 @@ if GetOption( "prefix" ):
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 @@ elif "win32" == os.sys.platform:
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 @@ elif "win32" == os.sys.platform:
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 --git a/db/concurrency.h b/db/concurrency.h
index de8f242..e841d61 100644
--- a/db/concurrency.h
+++ b/db/concurrency.h
@@ -113,16 +113,26 @@ namespace mongo {
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 @@ namespace mongo {
_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 @@ namespace mongo {
void lock() {
#ifdef HAVE_READLOCK
m.lock();
+#error this should be impossible?
#else
boost::detail::thread::lock_ops<boost::recursive_mutex>::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 @@ namespace mongo {
}
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 --git a/db/database.h b/db/database.h
index 868af0b..23bca7c 100644
--- a/db/database.h
+++ b/db/database.h
@@ -154,7 +154,7 @@ namespace mongo {
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 @@ namespace mongo {
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 @@ namespace mongo {
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 --git a/db/db.cpp b/db/db.cpp
index 51369bb..9be4031 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -193,22 +193,22 @@ namespace mongo {
LastError *le = new LastError();
lastError.reset(le);
- MessagingPort& dbMsgPort = *connGrab;
+ auto_ptr<MessagingPort> 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 @@ namespace mongo {
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 @@ namespace mongo {
}
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 --git a/db/instance.cpp b/db/instance.cpp
index 909911e..d8a76cb 100644
--- a/db/instance.cpp
+++ b/db/instance.cpp
@@ -96,11 +96,13 @@ namespace mongo {
scoped_lock bl(Client::clientsMutex);
for( set<Client*>::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 --git a/db/pdfile.cpp b/db/pdfile.cpp
index 80ae649..95bdb17 100644
--- a/db/pdfile.cpp
+++ b/db/pdfile.cpp
@@ -197,7 +197,7 @@ namespace mongo {
// $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 @@ namespace mongo {
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 @@ namespace mongo {
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 --git a/db/repl.cpp b/db/repl.cpp
index a0ac16e..efb078b 100644
--- a/db/repl.cpp
+++ b/db/repl.cpp
@@ -1720,22 +1720,21 @@ namespace mongo {
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 --git a/db/stats/top.cpp b/db/stats/top.cpp
index 0f27943..462bfe6 100644
--- a/db/stats/top.cpp
+++ b/db/stats/top.cpp
@@ -99,7 +99,7 @@ namespace mongo {
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 --git a/db/update.cpp b/db/update.cpp
index 6b9df9c..6dcfc78 100644
--- a/db/update.cpp
+++ b/db/update.cpp
@@ -67,7 +67,7 @@ namespace mongo {
ms.incint = elt.numberInt() + in.numberInt();
}
- ms.appendIncValue( bb );
+ ms.appendIncValue( bb , false );
}
template< class Builder >
diff --git a/db/update.h b/db/update.h
index 3c4daab..bfec7cd 100644
--- a/db/update.h
+++ b/db/update.h
@@ -413,7 +413,7 @@ namespace mongo {
void appendForOpLog( BSONObjBuilder& b ) const {
if ( incType ){
BSONObjBuilder bb( b.subobjStart( "$set" ) );
- appendIncValue( bb );
+ appendIncValue( bb , true );
bb.done();
return;
}
@@ -434,14 +434,16 @@ namespace mongo {
}
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 --git a/debian/changelog b/debian/changelog
index f2054cb..235dbcd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,26 +1,32 @@
+mongodb (1.4.4) unstable; urgency=low
+
+ * bug fixes, see http://jira.mongodb.org/browse/SERVER/fixforversion/10166
+
+ -- Richard Kreuter <richard@10gen.com> Tue, 29 Jun 2010 16:56:28 -0500
+
mongodb (1.4.3) unstable; urgency=low
- * bug fixes
+ * bug fixes, see http://jira.mongodb.org/browse/SERVER/fixforversion/10156
-- Richard Kreuter <richard@10gen.com> Tue, 24 May 2010 16:56:28 -0500
mongodb (1.4.2) unstable; urgency=low
- * bug fixes
+ * bug fixes, see http://jira.mongodb.org/browse/SERVER/fixforversion/10155
-- Richard Kreuter <richard@10gen.com> Tue, 27 Apr 2010 16:56:28 -0500
mongodb (1.4.1) unstable; urgency=low
- * bug fixes
+ * bug fixes, see http://jira.mongodb.org/browse/SERVER/fixforversion/10144
-- Richard Kreuter <richard@10gen.com> Wed, 14 Apr 2010 16:56:28 -0500
mongodb (1.4.0) unstable; urgency=low
- * stable release
+ * stable release, see http://jira.mongodb.org/browse/SERVER/fixforversion/10133
-- Richard Kreuter <richard@10gen.com> Wed, 22 Mar 2010 16:56:28 -0500
diff --git a/debian/files b/debian/files
new file mode 100644
index 0000000..2e28959
--- /dev/null
+++ b/debian/files
@@ -0,0 +1 @@
+mongodb_0.9.7_amd64.deb devel optional
diff --git a/debian/mongodb.upstart b/debian/mongodb.upstart
new file mode 100644
index 0000000..ca6f9b7
--- /dev/null
+++ b/debian/mongodb.upstart
@@ -0,0 +1,15 @@
+# Ubuntu upstart file at /etc/init/mongodb.conf
+
+pre-start script
+ mkdir -p /var/lib/mongodb/
+ mkdir -p /var/log/mongodb/
+end script
+
+start on runlevel [2345]
+stop on runlevel [06]
+
+script
+ ENABLE_MONGODB="yes"
+ if [ -f /etc/default/mongodb ]; then . /etc/default/mongodb; fi
+ if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb.conf; fi
+end script
diff --git a/debian/preinst b/debian/preinst
new file mode 100644
index 0000000..c2d5362
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,37 @@
+#!/bin/sh
+# preinst script for mongodb
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ install|upgrade)
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/doxygenConfig b/doxygenConfig
index 7584a63..653da41 100644
--- a/doxygenConfig
+++ b/doxygenConfig
@@ -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 --git a/jstests/disk/preallocate.js b/jstests/disk/preallocate.js
index c3c9bd0..d772fbb 100644
--- a/jstests/disk/preallocate.js
+++ b/jstests/disk/preallocate.js
@@ -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 --git a/jstests/disk/preallocate2.js b/jstests/disk/preallocate2.js
new file mode 100644
index 0000000..ee9382c
--- /dev/null
+++ b/jstests/disk/preallocate2.js
@@ -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 newline at end of file
diff --git a/jstests/repl/basic1.js b/jstests/repl/basic1.js
index 594ba07..0af26ac 100644
--- a/jstests/repl/basic1.js
+++ b/jstests/repl/basic1.js
@@ -121,12 +121,30 @@ t.update( { "b" : 3} , { $set : { "b.$" : 17 } } )
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 --git a/lib/libboost_thread-gcc41-mt-d-1_34_1.a b/lib/libboost_thread-gcc41-mt-d-1_34_1.a
new file mode 100644
index 0000000..09377ac
--- /dev/null
+++ b/lib/libboost_thread-gcc41-mt-d-1_34_1.a
Binary files differ
diff --git a/rpm/mongo.spec b/rpm/mongo.spec
index 8ad6a0f..79b5b60 100644
--- a/rpm/mongo.spec
+++ b/rpm/mongo.spec
@@ -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 @@ scons -c
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 --git a/stdafx.cpp b/stdafx.cpp
index 0e4bf45..e3d110d 100644
--- a/stdafx.cpp
+++ b/stdafx.cpp
@@ -32,6 +32,6 @@
namespace mongo {
- const char versionString[] = "1.4.3";
+ const char versionString[] = "1.4.4";
} // namespace mongo
diff --git a/util/message_server_port.cpp b/util/message_server_port.cpp
index fa8f9e5..2350ec2 100644
--- a/util/message_server_port.cpp
+++ b/util/message_server_port.cpp
@@ -31,7 +31,7 @@ namespace mongo {
void threadRun(){
assert( grab );
- MessagingPort * p = grab;
+ auto_ptr<MessagingPort> p( grab );
grab = 0;
Message m;
@@ -45,12 +45,11 @@ namespace mongo {
break;
}
- handler->process( m , p );
+ handler->process( m , p.get() );
}
}
catch ( ... ){
problem() << "uncaught exception in PortMessageServer::threadRun, closing connection" << endl;
- delete p;
}
}
diff --git a/util/ntservice.cpp b/util/ntservice.cpp
index 07dce20..251be92 100644
--- a/util/ntservice.cpp
+++ b/util/ntservice.cpp
@@ -111,11 +111,14 @@ namespace mongo {
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 --git a/util/processinfo_linux2.cpp b/util/processinfo_linux2.cpp
index eaaee09..917e707 100644
--- a/util/processinfo_linux2.cpp
+++ b/util/processinfo_linux2.cpp
@@ -38,7 +38,13 @@ namespace mongo {
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 "