Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85c3e9551c | ||
|
|
9045c292fc | ||
|
|
eafca06a88 | ||
|
|
ebf50d623e | ||
|
|
736490eeef | ||
|
|
57a6542753 | ||
|
|
a705bdb4dd | ||
|
|
6b748b2ccd | ||
|
|
e316c78bc3 | ||
|
|
1c04baf944 | ||
|
|
f40cd45c17 | ||
|
|
5049bce6a0 | ||
|
|
8c29986cf7 | ||
|
|
1a4490dbba | ||
|
|
afe21e02c1 | ||
|
|
dabf2ce546 |
@ -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
|
||||
|
||||
@ -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 ) {
|
||||
|
||||
@ -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() );
|
||||
}
|
||||
|
||||
@ -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. */
|
||||
|
||||
@ -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();
|
||||
|
||||
13
db/query.cpp
13
db/query.cpp
@ -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 ) );
|
||||
|
||||
@ -25,7 +25,7 @@ namespace mongo {
|
||||
|
||||
bool noauth = true;
|
||||
|
||||
int AuthenticationInfo::warned;
|
||||
int AuthenticationInfo::warned = 0;
|
||||
|
||||
} // namespace mongo
|
||||
|
||||
|
||||
@ -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) )
|
||||
|
||||
@ -55,7 +55,7 @@ namespace mongo {
|
||||
bool questionable() {
|
||||
return ofs < -1 ||
|
||||
fileNo < -1 ||
|
||||
fileNo > 20;
|
||||
fileNo > 524288;
|
||||
}
|
||||
|
||||
bool isNull() const {
|
||||
|
||||
@ -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 >();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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
8
jstests/indexapi.js
Normal 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" );
|
||||
@ -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 );
|
||||
|
||||
@ -33,6 +33,6 @@
|
||||
|
||||
namespace mongo {
|
||||
|
||||
const char versionString[] = "0.9.10";
|
||||
const char versionString[] = "1.0.2-";
|
||||
|
||||
} // namespace mongo
|
||||
|
||||
Loading…
Reference in New Issue
Block a user