mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-29 16:47:28 +01:00
Don't attempt to make cursor tail immediately if not at end
This commit is contained in:
parent
d4fad81da1
commit
99dd91cddc
@ -770,7 +770,7 @@ namespace mongo {
|
||||
} else if ( ordering_ ) {
|
||||
so_->fill(b_, &filter_, n_);
|
||||
}
|
||||
else if ( !saveClientCursor_ && (queryOptions_ & Option_CursorTailable) && c_->tailable() ) {
|
||||
else if ( !saveClientCursor_ && !c_->ok() && (queryOptions_ & Option_CursorTailable) && c_->tailable() ) {
|
||||
c_->setAtTail();
|
||||
saveClientCursor_ = true;
|
||||
}
|
||||
|
@ -219,6 +219,9 @@ namespace QueryTests {
|
||||
|
||||
class GetMore : public ClientBase {
|
||||
public:
|
||||
~GetMore() {
|
||||
client().dropCollection( "querytests.GetMore" );
|
||||
}
|
||||
void run() {
|
||||
const char *ns = "querytests.GetMore";
|
||||
insert( ns, BSON( "a" << 1 ) );
|
||||
@ -234,6 +237,23 @@ namespace QueryTests {
|
||||
}
|
||||
};
|
||||
|
||||
class ReturnOneOfManyAndTail : public ClientBase {
|
||||
public:
|
||||
~ReturnOneOfManyAndTail() {
|
||||
client().dropCollection( "querytests.ReturnOneOfManyAndTail" );
|
||||
}
|
||||
void run() {
|
||||
const char *ns = "querytests.ReturnOneOfManyAndTail";
|
||||
insert( ns, BSON( "a" << 0 ) );
|
||||
insert( ns, BSON( "a" << 1 ) );
|
||||
insert( ns, BSON( "a" << 2 ) );
|
||||
auto_ptr< DBClientCursor > c = client().query( ns, QUERY( "a" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 1, 0, 0, Option_CursorTailable );
|
||||
ASSERT_EQUALS( 0, c->getCursorId() );
|
||||
ASSERT( c->more() );
|
||||
ASSERT_EQUALS( 1, c->next().getIntField( "a" ) );
|
||||
}
|
||||
};
|
||||
|
||||
class All : public UnitTest::Suite {
|
||||
public:
|
||||
All() {
|
||||
@ -250,6 +270,7 @@ namespace QueryTests {
|
||||
add< ModNonNumber >();
|
||||
add< BoundedKey >();
|
||||
add< GetMore >();
|
||||
add< ReturnOneOfManyAndTail >();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user