Compare commits

...

20 Commits

Author SHA1 Message Date
Eliot Horowitz
45992de574 BUMP 1.2.1 2009-12-30 13:01:40 -05:00
Mathias Stearn
961d3ab8b2 Backport fix to 1.2 branch. SERVER-410. 2009-12-29 17:13:03 -05:00
Eliot Horowitz
f8f12e8d13 beter error handling in m/r 2009-12-29 14:26:12 -05:00
Eliot Horowitz
720eecdc01 fix compile 2009-12-22 12:58:41 -05:00
Eliot Horowitz
5dc18ddb3b better repl debugging 2009-12-22 11:07:36 -05:00
Eliot Horowitz
9280f63a83 fix compile on gcc 4.4.2 2009-12-20 07:17:54 -05:00
Eliot Horowitz
007da4fdc7 make --quiet not print out connection accepted SERVER-498 2009-12-20 07:17:37 -05:00
Eliot Horowitz
a0d90a4478 make --repair for a full repair 2009-12-15 20:54:02 -05:00
Eliot Horowitz
697c07f8c9 1.2.1- 2009-12-10 21:31:15 -05:00
Eliot Horowitz
2add01f37d BUMP 1.2.0 2009-12-10 10:27:04 -05:00
Aaron
0775d99ea1 SERVER-469 don't crash when authenticate called before getnonce 2009-12-10 10:16:25 -05:00
Eliot Horowitz
d6d9ce8ffe slaves can clone system.js SERVER-466 2009-12-09 10:19:11 -05:00
Eliot Horowitz
306c8c6b98 fix names 2009-12-08 12:19:09 -05:00
Eliot Horowitz
87f324edf8 prefix/postfix 2009-12-06 19:49:54 -05:00
Eliot Horowitz
89b0957a41 versions for build bot finding 2009-12-06 19:18:30 -05:00
Eliot Horowitz
05c32be539 post vs. 1.1.4 2009-12-05 11:54:52 -05:00
Eliot Horowitz
c0b78e37b5 if non master, use branch name in file 2009-12-05 11:54:36 -05:00
Eliot Horowitz
cb39613c0f better tests 2009-12-03 17:25:39 -05:00
Eliot Horowitz
ad7fc89083 BUMP 1.1.4 2009-12-03 15:03:20 -05:00
Eliot Horowitz
3c6a8cf7b7 initial stab at rpm files SERVER-396 2009-12-03 14:21:22 -05:00
21 changed files with 353 additions and 21 deletions

View File

@@ -604,6 +604,29 @@ except OSError:
# --- check system ---
def getGitBranch():
if not os.path.exists( ".git" ):
return None
version = open( ".git/HEAD" ,'r' ).read().strip()
if not version.startswith( "ref: " ):
return version
version = version.split( "/" )
version = version[len(version)-1]
return version
def getGitBranchString( prefix="" , postfix="" ):
t = re.compile( '[/\\\]' ).split( os.getcwd() )
if len(t) > 2 and t[len(t)-1] == "mongo":
t = re.compile( ".*_([vV]\d+\.\d+)$" ).match( t[len(t)-2] )
if t is not None:
return prefix + t.group(1).lower() + postfix
b = getGitBranch()
if b == None or b == "master":
return ""
return prefix + b + postfix
def getGitVersion():
if not os.path.exists( ".git" ):
return "nogitversion"
@@ -1240,7 +1263,9 @@ def getDistName( sofar ):
distName = version
return version
return today.strftime( "%Y-%m-%d" )
return getGitBranchString( "" , "-" ) + today.strftime( "%Y-%m-%d" )
if distBuild:
from datetime import date
@@ -1361,7 +1386,7 @@ def s3push( localName , remoteName=None , remotePrefix=None , fixName=True , pla
if remotePrefix is None:
if distName is None:
remotePrefix = "-latest"
remotePrefix = getGitBranchString( "-" ) + "-latest"
else:
remotePrefix = "-" + distName

View File

@@ -16,6 +16,7 @@
*/
#include "../stdafx.h"
#include "../db/cmdline.h"
namespace mongo {
@@ -23,6 +24,8 @@ namespace mongo {
bool quiet = false;
CmdLine cmdLine;
// Database* database = 0;
bool dbexitCalled = false;

View File

@@ -103,7 +103,7 @@ namespace mongo {
/* must call when a btree bucket going away.
note this is potentially slow
*/
inline void ClientCursor::informAboutToDeleteBucket(const DiskLoc& b) {
void ClientCursor::informAboutToDeleteBucket(const DiskLoc& b) {
recursive_boostlock lock(ccmutex);
RARELY if ( byLoc.size() > 70 ) {
log() << "perf warning: byLoc.size=" << byLoc.size() << " in aboutToDeleteBucket\n";

View File

@@ -216,7 +216,7 @@ namespace mongo {
if( strstr(from_name, ".system.") ) {
/* system.users is cloned -- but nothing else from system. */
if( strstr(from_name, ".system.users") == 0 ){
if( legalClientSystemNS( from_name , true ) == 0 ){
log(2) << "\t\t not cloning because system collection" << endl;
continue;
}

View File

@@ -283,7 +283,7 @@ namespace mongo {
bool doDBUpgrade( const string& dbName , string errmsg , MDFHeader * h ){
static DBDirectClient db;
if ( h->version == 4 && h->versionMinor == 4 ){
if ( forceRepair == false && h->version == 4 && h->versionMinor == 4 ){
assert( VERSION == 4 );
assert( VERSION_MINOR == 5 );

View File

@@ -205,7 +205,13 @@ namespace mongo {
scope->localConnect( setup.dbname.c_str() );
map = scope->createFunction( setup.mapCode.c_str() );
if ( ! map )
throw UserException( (string)"map compile failed: " + scope->getError() );
reduce = scope->createFunction( setup.reduceCode.c_str() );
if ( ! reduce )
throw UserException( (string)"reduce compile failed: " + scope->getError() );
if ( setup.finalizeCode.size() )
finalize = scope->createFunction( setup.finalizeCode.c_str() );
else

View File

@@ -860,7 +860,7 @@ namespace mongo {
if ( replAllDead ) {
// hmmm why is this check here and not at top of this function? does it get set between top and here?
log() << "replAllDead, throwing SyncException\n";
log() << "replAllDead, throwing SyncException: " << replAllDead << endl;
throw SyncException();
}

View File

@@ -97,11 +97,17 @@ namespace mongo {
stringstream digestBuilder;
{
bool reject = false;
nonce *ln = lastNonce.release();
digestBuilder << hex << *ln;
if( ln == 0 || digestBuilder.str() != received_nonce ) {
log() << "auth: bad nonce received. could be a driver bug or a security attack. db:" << cc().database()->name << '\n';
if ( ln == 0 ) {
reject = true;
} else {
digestBuilder << hex << *ln;
reject = digestBuilder.str() != received_nonce;
}
if ( reject ) {
log() << "auth: bad nonce received or getnonce not called. could be a driver bug or a security attack. db:" << cc().database()->name << '\n';
errmsg = "auth fails";
sleepmillis(30);
return false;

2
debian/changelog vendored
View File

@@ -1,4 +1,4 @@
mongodb (1.1.3) unstable; urgency=low
mongodb (1.2.1) stable; urgency=low
* Initial release

View File

@@ -3,7 +3,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = MongoDB
PROJECT_NUMBER = 1.1.3
PROJECT_NUMBER = 1.2.1 db
OUTPUT_DIRECTORY = docs
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English

11
jstests/auth2.js Normal file
View File

@@ -0,0 +1,11 @@
db2 = new Mongo( db.getMongo().host ).getDB( db.getName() );
users = db2.getCollection( "system.users" );
users.remove( {} );
pass = "a" + Math.random();
//print( "password [" + pass + "]" );
db2.addUser( "eliot" , pass );
assert.commandFailed( db2.runCommand( { authenticate: 1, user: "eliot", nonce: "foo", key: "bar" } ) );

View File

@@ -134,7 +134,7 @@ if ( true ){
print( "t1: " + Date.timeFunc(
function(){
var out = db.runCommand( { mapreduce : "mr1" , map : m , reduce : r } );
if ( ks == "_id" ) assert( out.ok , "XXX" );
if ( ks == "_id" ) assert( out.ok , "XXX : " + tojson( out ) );
db[out.result].drop();
} , 10 ) + " (~500 on 2.8ghz) - itcount: " + Date.timeFunc( function(){ db.mr1.find().itcount(); } , 10 ) );

View File

@@ -208,6 +208,7 @@
93A6E10D0F24CFB100DA4EBF /* flushtest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = flushtest.cpp; sourceTree = "<group>"; };
93A6E10E0F24CFD300DA4EBF /* security.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = security.h; sourceTree = "<group>"; };
93A6E10F0F24CFEA00DA4EBF /* security_commands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = security_commands.cpp; sourceTree = "<group>"; };
93A71D2D10D04D15003C9E90 /* auth2.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = auth2.js; sourceTree = "<group>"; };
93A8CD170F33B78D00C92B85 /* mmap_mm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mmap_mm.cpp; path = util/mmap_mm.cpp; sourceTree = SOURCE_ROOT; };
93A8CD180F33B7A000C92B85 /* mmap_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mmap_posix.cpp; path = util/mmap_posix.cpp; sourceTree = SOURCE_ROOT; };
93A8CD190F33B7AF00C92B85 /* mmap_win.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mmap_win.cpp; path = util/mmap_win.cpp; sourceTree = SOURCE_ROOT; };
@@ -641,6 +642,7 @@
93A8D1D10F37544800C92B85 /* jstests */ = {
isa = PBXGroup;
children = (
93A71D2D10D04D15003C9E90 /* auth2.js */,
935E7B8A0FCF37D40024B2E5 /* sharding */,
936D937F0FCC67C700004410 /* index9.js */,
936D931B0FCC58C900004410 /* regex.js */,

63
rpm/init.d-mongod Normal file
View File

@@ -0,0 +1,63 @@
#!/bin/bash
# mongod - Startup script for mongod
# chkconfig: 35 85 15
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /etc/mongod.conf
# pidfile: /var/run/mongo/mongo.pid
. /etc/rc.d/init.d/functions
# things from mongod.conf get there by mongod reading it
OPTIONS=" -f /etc/mongod.conf"
mongod=${MONGOD-/usr/bin/mongod}
pidfile=${PIDFILE-/var/run/mongod.pid}
lockfile=${LOCKFILE-/var/lock/subsys/mongod}
start()
{
echo -n $"Starting mongod: "
#daemon --pidfile=${pidfile} $mongod $OPTIONS > /var/log/mongod
$mongod $OPTIONS > /var/log/mongod 2>&1 &
RETVAL=$?
[ $RETVAL = 0 ] && touch ${lockfile}
echo OK
}
stop()
{
echo -n $"Stopping mongod: "
#killproc -p ${pidfile} -d 10 $mongod
#RETVAL=$?
killall mongod > /dev/null 2>&1
#[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
echo OK
}
ulimit -n 12000
RETVAL=0
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
# status)
# status -p ${pidfile} $mongod
# ;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL

128
rpm/mongo.spec Normal file
View File

@@ -0,0 +1,128 @@
Name: mongo
Version: 1.2.1
Release: mongodb_1%{?dist}
Summary: mongo client shell and tools
License: AGPL 3.0
URL: http://www.mongodb.org
Group: Applications/Databases
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: js-devel, readline-devel, boost-devel, pcre-devel
BuildRequires: gcc-c++, scons
%description
Mongo (from "huMONGOus") is a schema-free document-oriented database.
It features dynamic profileable queries, full indexing, replication
and fail-over support, efficient storage of large binary data objects,
and auto-sharding.
This package provides the mongo shell, import/export tools, and other
client utilities.
%package server
Summary: mongo server, sharding server, and support scripts
Group: Applications/Databases
%description server
Mongo (from "huMONGOus") is a schema-free document-oriented database.
This package provides the mongo server software, mongo sharding server
softwware, default configuration files, and init.d scripts.
%package devel
Summary: Headers and libraries for mongo development.
Group: Applications/Databases
%description devel
Mongo (from "huMONGOus") is a schema-free document-oriented database.
This package provides the mongo static library and header files needed
to develop mongo client software.
%prep
%setup
%build
scons --prefix=$RPM_BUILD_ROOT/usr all
# XXX really should have shared library here
%install
scons --prefix=$RPM_BUILD_ROOT/usr install
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1
cp debian/*.1 $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
cp rpm/init.d-mongod $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
chmod a+x $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
mkdir -p $RPM_BUILD_ROOT/etc
cp rpm/mongod.conf $RPM_BUILD_ROOT/etc/mongod.conf
mkdir -p $RPM_BUILD_ROOT/var/lib/mongo
mkdir -p $RPM_BUILD_ROOT/var/log
touch $RPM_BUILD_ROOT/var/log/mongo
%clean
scons -c
rm -rf $RPM_BUILD_ROOT
%pre server
#/usr/sbin/useradd -M -o -r -d /var/mongo -s /bin/bash \
# -c "mongod" mongod > /dev/null 2>&1 || :
%post server
if test $1 = 1
then
/sbin/chkconfig --add mongod
fi
%preun server
if test $1 = 0
then
/sbin/chkconfig --del mongod
fi
%postun server
if test $1 -ge 1
then
/sbin/service mongod stop >/dev/null 2>&1 || :
fi
%files
%defattr(-,root,root,-)
%doc README GNU-AGPL-3.0.txt
%{_bindir}/mongo
%{_bindir}/mongodump
%{_bindir}/mongoexport
%{_bindir}/mongofiles
%{_bindir}/mongoimport
%{_bindir}/mongorestore
%{_mandir}/man1/mongo.1*
%{_mandir}/man1/mongodump.1*
%{_mandir}/man1/mongoexport.1*
%{_mandir}/man1/mongofiles.1*
%{_mandir}/man1/mongoimport.1*
%{_mandir}/man1/mongorestore.1*
%files server
%defattr(-,root,root,-)
%config(noreplace) /etc/mongod.conf
%{_bindir}/mongod
%{_bindir}/mongos
#%{_mandir}/man1/mongod.1*
%{_mandir}/man1/mongos.1*
/etc/rc.d/init.d/mongod
/etc/sysconfig/mongod
#/etc/rc.d/init.d/mongos
%attr(0755,root,root) %dir /var/mongo
%attr(0640,root,root) %config(noreplace) %verify(not md5 size mtime) /var/log/mongo
%files devel
/usr/include/mongo
%{_libdir}/libmongoclient.a
#%{_libdir}/libmongotestfiles.a
%changelog
* Sat Oct 24 2009 Joe Miklojcik <jmiklojcik@shopwiki.com> -
- Wrote mongo.spec.

86
rpm/mongod.conf Normal file
View File

@@ -0,0 +1,86 @@
# mongo.conf
#where to log
logpath=/var/log/mongod
#port = 27017
dbpath=/var/lib/mongo
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
# Turn on/off security. Off is currently the default
#noauth = true
#auth = true
# Verbose logging output.
#verbose = true
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
# Enable db quota management
#quota = true
# Set oplogging level where n is
# 0=off (default)
# 1=W
# 2=R
# 3=both
# 7=W+some reads
#oplog = 0
# Diagnostic/debugging option
#nocursors = true
# Ignore query hints
#nohints = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
# Turns off server-side scripting. This will result in greatly limited
# functionality
#noscripting = true
# Turns off table scans. Any query that would do a table scan fails.
#notablescan = true
# Disable data file preallocation.
#noprealloc = true
# Specify .ns file size for new databases.
# nssize = <size>
# Accout token for Mongo monitoring server.
#mms-token = <token>
# Server name for Mongo monitoring server.
#mms-name = <server-name>
# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>
# Replication Options
# in replicated mongo databases, specify here whether this is a slave or master
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com
# Address of a server to pair with.
#pairwith = <server:port>
# Address of arbiter server.
#arbiter = <server:port>
# Automatically resync if slave data is stale
#autoresync
# Custom size for replication operation log.
#oplogSize = <MB>
# Size limit for in-memory storage of op ids.
#opIdMem = <bytes>

View File

@@ -171,7 +171,7 @@ int main(int argc, char* argv[], char *envp[] ) {
return 1;
}
log() << argv[0] << " v0.3- (alpha 3r) starting (--help for usage)" << endl;
log() << argv[0] << " v0.2.6 (alpha 2f) starting (--help for usage)" << endl;
printGitVersion();
printSysInfo();

View File

@@ -32,6 +32,6 @@
namespace mongo {
const char versionString[] = "1.1.4-";
const char versionString[] = "1.2.1";
} // namespace mongo

View File

@@ -198,13 +198,14 @@ public:
log(1) << "filesize: " << fileSize << endl;
ProgressMeter pm( fileSize );
const int BUF_SIZE = 1024 * 1024 * 4;
char line[ (1024 * 1024 * 4) + 128];
boost::scoped_array<char> line (new char[BUF_SIZE]);
while ( *in ){
in->getline( line , BUF_SIZE );
uassert( "unknown error reading file" , ( in->rdstate() & ios_base::badbit ) == 0 );
log(1) << "got line:" << line << endl;
char * buf = line.get();
in->getline( buf , BUF_SIZE );
uassert( "unknown error reading file" , ( in->rdstate() & ios_base::badbit ) == 0 );
log(1) << "got line:" << buf << endl;
char * buf = line;
while( isspace( buf[0] ) ) buf++;
int len = strlen( buf );

View File

@@ -25,6 +25,7 @@
#include "../util/background.h"
#include <fcntl.h>
#include <errno.h>
#include "../db/cmdline.h"
namespace mongo {
@@ -84,7 +85,7 @@ namespace mongo {
continue;
}
disableNagle(s);
log() << "connection accepted from " << from.toString() << " #" << ++connNumber << endl;
if ( ! cmdLine.quiet ) log() << "connection accepted from " << from.toString() << " #" << ++connNumber << endl;
accepted( new MessagingPort(s, from) );
}
}