Compare commits

...

16 Commits
r4.0.2 ... v1.0

Author SHA1 Message Date
Eliot Horowitz
85c3e9551c Merge branch 'v1.0' of git@github.com:mongodb/mongo into v1.0 2009-12-07 15:03:18 -05:00
Eliot Horowitz
9045c292fc version # 2009-12-07 12:27:31 -05:00
Eliot Horowitz
eafca06a88 old version of shell 2009-12-07 11:54:01 -05:00
Eliot Horowitz
ebf50d623e security cleanup / segault fix in currentOp SERVER-384 2009-12-07 11:13:09 -05:00
Eliot Horowitz
736490eeef remove wrong assertion SERVER-386 2009-12-07 11:11:04 -05:00
Eliot Horowitz
57a6542753 fix invalid ensureIndex crashing server SERVER-388
Conflicts:

	db/pdfile.cpp
	jstests/indexapi.js
2009-12-07 11:10:46 -05:00
Eliot Horowitz
a705bdb4dd use 1.0 in the dist name 2009-12-06 00:36:48 -05:00
Dwight
6b748b2ccd validate skip() value on a query 2009-10-26 10:34:37 -04:00
Eliot Horowitz
e316c78bc3 removed 1 test that shouldn't have been merged 2009-10-22 11:22:10 -04:00
Eliot Horowitz
1c04baf944 version # 1.0.1 2009-10-22 10:54:24 -04:00
Eliot Horowitz
f40cd45c17 safety to ensure we don't use a new pdfiel version or something with > 10 indexes 2009-10-22 10:51:16 -04:00
Eliot Horowitz
5049bce6a0 fix bug with cursors and capped collections where cursor could get partial data
possible merge conflict
2009-10-20 09:53:03 -04:00
Eliot Horowitz
8c29986cf7 make getMore buffer big since we know there are lots of results 2009-10-19 17:38:45 -04:00
Eliot Horowitz
1a4490dbba validate() says invalid if more than 20 files SERVER-269 2009-08-28 10:17:32 -04:00
Eliot Horowitz
afe21e02c1 look for settings.py backwards a bit 2009-08-27 11:53:01 -04:00
Eliot Horowitz
dabf2ce546 1.0.0 marker 2009-08-27 09:46:00 -04:00
14 changed files with 126 additions and 16 deletions

View File

@@ -1172,7 +1172,7 @@ def getDistName( sofar ):
distName = version
return version
return today.strftime( "%Y-%m-%d" )
return "v1.0-" + today.strftime( "%Y-%m-%d" )
if distBuild:
from datetime import date
@@ -1285,11 +1285,13 @@ def s3push( localName , remoteName=None , remotePrefix=None , fixName=True , pla
if remotePrefix is None:
if distName is None:
remotePrefix = "-latest"
remotePrefix = "-v1.0-latest"
else:
remotePrefix = "-" + distName
sys.path.append( "." )
sys.path.append( ".." )
sys.path.append( "../../" )
import simples3
import settings

View File

@@ -134,6 +134,11 @@ namespace mongo {
i != toAdvance.end(); ++i )
{
Cursor *c = (*i)->c.get();
if ( c->capped() ){
delete *i;
continue;
}
c->checkLocation();
DiskLoc tmp1 = c->refLoc();
if ( tmp1 != dl ) {

View File

@@ -305,10 +305,9 @@ namespace mongo {
MDFHeader *h = p->getHeader();
if ( !h->currentVersion() ) {
// QUESTION: Repair even if file format is higher version than code?
log() << "repairing database " << dbName << " with pdfile version " << h->version << "." << h->versionMinor << ", "
<< "new version: " << VERSION << "." << VERSION_MINOR << endl;
string errmsg;
assert( repairDatabase( dbName.c_str(), errmsg ) );
log() << "can't migrate data version " << dbName << " with pdfile version " << h->version << "." << h->versionMinor << ", "
<< "new version: " << VERSION << "." << VERSION_MINOR << endl;
throw UserException( "wrong data file version" );
} else {
closeClient( dbName.c_str() );
}

View File

@@ -422,6 +422,7 @@ namespace mongo {
// Last, in case we're killed before getting here
capExtent = firstExtent;
}
assert( nIndexes <= 10 ); // make sure we aren't trying to use new index format with 1.0.x server
}
/* alloc with capped table handling. */

View File

@@ -1156,6 +1156,7 @@ assert( !eloc.isNull() );
DiskLoc DataFileMgr::insert(const char *ns, const void *obuf, int len, bool god, const BSONElement &writeId, bool mayAddIndex) {
bool wouldAddIndex = false;
uassert("cannot insert into reserved $ collection", god || strchr(ns, '$') == 0 );
uassert("invalid ns", strchr( ns , '.' ) > 0 );
const char *sys = strstr(ns, "system.");
if ( sys ) {
uassert("attempt to insert in reserved database name 'system'", sys != ns);
@@ -1198,6 +1199,7 @@ assert( !eloc.isNull() );
const char *name = io.getStringField("name"); // name of the index
tabletoidxns = io.getStringField("ns"); // table it indexes
uassert( "invalid ns to index" , tabletoidxns.size() && tabletoidxns.find( '.' ) != string::npos );
if ( database->name != nsToClient(tabletoidxns.c_str()) ) {
uassert("bad table to index name on add index attempt", false);
return DiskLoc();

View File

@@ -907,9 +907,14 @@ namespace mongo {
}
QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid) {
BufBuilder b(32768);
ClientCursor *cc = ClientCursor::find(cursorid);
int bufSize = 512;
if ( cc ){
bufSize += sizeof( QueryResult );
bufSize += ( ntoreturn ? 4 : 1 ) * 1024 * 1024;
}
BufBuilder b( bufSize );
b.skip(sizeof(QueryResult));
@@ -1116,7 +1121,9 @@ namespace mongo {
saveClientCursor_(),
findingStart_( (queryOptions & Option_OplogReplay) != 0 ),
findingStartCursor_()
{}
{
uassert("bad skip value in query", ntoskip >= 0);
}
virtual void init() {
b_.skip( sizeof( QueryResult ) );

View File

@@ -25,7 +25,7 @@ namespace mongo {
bool noauth = true;
int AuthenticationInfo::warned;
int AuthenticationInfo::warned = 0;
} // namespace mongo

View File

@@ -58,6 +58,7 @@ namespace mongo {
if( m["admin"].level == 2 ) return true;
if( m["local"].level == 2 ) return true;
if( isLocalHost ) {
dblock l; // TODO: this is bad, since we want to be able to check this even if outside global lock. probably goes away with concurrency
DBContext c("admin.system.users");
BSONObj result;
if( Helpers::getSingleton("admin.system.users", result) )

View File

@@ -55,7 +55,7 @@ namespace mongo {
bool questionable() {
return ofs < -1 ||
fileNo < -1 ||
fileNo > 20;
fileNo > 524288;
}
bool isNull() const {

View File

@@ -639,7 +639,91 @@ namespace QueryTests {
ASSERT_EQUALS( 2U, client().count( ns, BSON( "foo.bar" << "spam" ) ) );
}
};
class DifferentNumbers : public ClientBase {
public:
~DifferentNumbers(){
client().dropCollection( "unittests.querytests.DifferentNumbers" );
}
void t( const char * ns ){
auto_ptr< DBClientCursor > cursor = client().query( ns, Query().sort( "7" ) );
while ( cursor->more() ){
BSONObj o = cursor->next();
cout << " foo " << o << endl;
}
}
void run() {
const char *ns = "unittests.querytests.DifferentNumbers";
{ BSONObjBuilder b; b.append( "7" , (int)4 ); client().insert( ns , b.obj() ); }
{ BSONObjBuilder b; b.append( "7" , (long long)2 ); client().insert( ns , b.obj() ); }
{ BSONObjBuilder b; b.appendNull( "7" ); client().insert( ns , b.obj() ); }
{ BSONObjBuilder b; b.append( "7" , "b" ); client().insert( ns , b.obj() ); }
{ BSONObjBuilder b; b.appendNull( "8" ); client().insert( ns , b.obj() ); }
{ BSONObjBuilder b; b.append( "7" , (double)3.7 ); client().insert( ns , b.obj() ); }
t(ns);
client().ensureIndex( ns , BSON( "7" << 1 ) );
t(ns);
}
};
class TailableCappedRaceCondition : public ClientBase {
public:
TailableCappedRaceCondition(){
client().dropCollection( ns() );
_n = 0;
}
~TailableCappedRaceCondition(){
client().dropCollection( ns() );
}
int count(){
return client().count( ns() );
}
void run(){
string err;
ASSERT( userCreateNS( ns() , fromjson( "{ capped : true , size : 2000 }" ) , err , false ) );
for ( int i=0; i<100; i++ ){
insertNext();
ASSERT( count() < 40 );
}
int a = count();
auto_ptr< DBClientCursor > c = client().query( ns() , QUERY( "i" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, Option_CursorTailable );
int n=0;
while ( c->more() ){
BSONObj z = c->next();
n++;
}
ASSERT_EQUALS( a , n );
insertNext();
ASSERT( c->more() );
for ( int i=0; i<50; i++ ){
insertNext();
}
while ( c->more() ){ c->next(); }
ASSERT( c->isDead() );
}
const char * ns(){
return "unittests.querytests.tailablecappedrace";
}
void insertNext(){
insert( ns() , BSON( "i" << _n++ ) );
}
int _n;
};
class All : public Suite {
public:
All() {
@@ -674,6 +758,8 @@ namespace QueryTests {
add< DirectLocking >();
add< FastCountIn >();
add< EmbeddedArray >();
add< DifferentNumbers >();
add< TailableCappedRaceCondition >();
}
};

View File

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

8
jstests/indexapi.js Normal file
View File

@@ -0,0 +1,8 @@
t = db.indexapi;
t.drop();
key = { x : 1 };
db.system.indexes.insert( { ns : "test" , key : { x : 1 } , name : "x" } );
assert( db.getLastError().indexOf( "invalid" ) >= 0 , "Z1" );

View File

@@ -417,9 +417,8 @@ namespace mongo {
}
int n = embed.nFields();
assert( n > 0 );
JSObject * array = JS_NewArrayObject( _context , embed.nFields() , 0 );
JSObject * array = JS_NewArrayObject( _context , n , 0 );
assert( array );
jsval myarray = OBJECT_TO_JSVAL( array );

View File

@@ -33,6 +33,6 @@
namespace mongo {
const char versionString[] = "0.9.10";
const char versionString[] = "1.0.2-";
} // namespace mongo