0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

finishCloneCollection checkpoint

This commit is contained in:
Aaron 2009-03-11 17:37:25 -04:00
parent 502e20f1cc
commit 93ac9027cd
3 changed files with 23 additions and 10 deletions

View File

@ -270,8 +270,14 @@ namespace mongo {
c = conn->query( logNS.c_str(), Query(), 0, 0, 0, Option_CursorTailable );
}
cout << "start cursorId: " << c->getCursorId() << endl;
replayOpLog( c.get(), query );
cursorId = c->getCursorId();
if ( c->more() ) {
replayOpLog( c.get(), query );
cursorId = c->getCursorId();
massert( "Expected valid tailing cursor", cursorId != 0 );
} else {
massert( "Did not expect valid cursor for empty query result", c->getCursorId() == 0 );
cursorId = 0;
}
cout << "set cursorId: " << cursorId << endl;
c->decouple();
return true;
@ -298,6 +304,8 @@ namespace mongo {
char db[256];
nsToClient( ns, db );
cout << "using cursorId: " << cursorId << endl;
auto_ptr< DBClientCursor > cur;
{
dbtemprelease r;
@ -308,7 +316,10 @@ namespace mongo {
return false;
conn = c;
string logNS = "local.temp.oplog." + string( ns );
cur = conn->getMore( logNS.c_str(), cursorId );
if ( cursorId != 0 )
cur = conn->getMore( logNS.c_str(), cursorId );
else
cur = conn->query( logNS.c_str(), Query() );
}
replayOpLog( cur.get(), query );
{
@ -441,10 +452,10 @@ namespace mongo {
cursorId = cursorIdToken.date();
cout << "val: " << cursorIdToken.date() << endl;
}
if ( cursorId == 0 ) {
errmsg = "invalid cursorId spec";
return false;
}
// if ( cursorId == 0 ) {
// errmsg = "invalid cursorId spec";
// return false;
// }
setClient( collection.c_str() );

View File

@ -949,7 +949,7 @@ assert( !eloc.isNull() );
Timer t;
Nullstream& l = log();
l << "building new index for " << ns << "...";
l << "building new index on " << idx.keyPattern() << " for " << ns << "...";
l.flush();
int err = 0;
int n = 0;

View File

@ -511,22 +511,24 @@ namespace mongo {
int n = 0;
if ( !cc ) {
DEV log() << "getMore: cursorid not found " << ns << " " << cursorid << endl;
log() << "getMore: cursorid not found " << ns << " " << cursorid << endl;
cursorid = 0;
resultFlags = QueryResult::ResultFlag_CursorNotFound;
}
else {
log() << "getMore: cursorid found " << ns << " " << cursorid << endl;
start = cc->pos;
Cursor *c = cc->c.get();
c->checkLocation();
c->tailResume();
while ( 1 ) {
if ( !c->ok() ) {
cout << "tailing? : " << c->tailing() << endl;
if ( c->tailing() ) {
c->setAtTail();
break;
}
DEV log() << " getmore: last batch, erasing cursor " << cursorid << endl;
log() << " getmore: last batch, erasing cursor " << cursorid << endl;
bool ok = ClientCursor::erase(cursorid);
assert(ok);
cursorid = 0;