summaryrefslogtreecommitdiff
path: root/dbtests/repltests.cpp
diff options
context:
space:
mode:
authorAaron Staple <aaron@Aaron-Staples-MacBook-Pro.local>2011-08-15 20:26:14 -0700
committerAaron <aaron@10gen.com>2011-08-17 21:03:54 -0700
commit44939bd8634abc88115a8916d03a37de19a0641c (patch)
tree946b15c99ea9b22d5321aec8d01540a1476ef110 /dbtests/repltests.cpp
parente52a031a3272a78e25ce71829a730ef8501a1c85 (diff)
downloadmongo-44939bd8634abc88115a8916d03a37de19a0641c.tar.gz
SERVER-3554 assert on failed yield recovery in finding start cursor
Diffstat (limited to 'dbtests/repltests.cpp')
-rw-r--r--dbtests/repltests.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/dbtests/repltests.cpp b/dbtests/repltests.cpp
index 2bf522555ab..0b53d36140d 100644
--- a/dbtests/repltests.cpp
+++ b/dbtests/repltests.cpp
@@ -1076,6 +1076,32 @@ namespace ReplTests {
}
};
+ /** Check unsuccessful yield recovery with FindingStartCursor */
+ class FindingStartCursorYield : public Base {
+ public:
+ void run() {
+ for( int i = 0; i < 10; ++i ) {
+ client()->insert( ns(), BSON( "_id" << i ) );
+ }
+ Date_t ts = client()->query( "local.oplog.$main", Query().sort( BSON( "$natural" << 1 ) ), 1, 4 )->next()[ "ts" ].date();
+ Client::Context ctx( cllNS() );
+ NamespaceDetails *nsd = nsdetails( cllNS() );
+ BSONObjBuilder b;
+ b.appendDate( "$gte", ts );
+ BSONObj query = BSON( "ts" << b.obj() );
+ FieldRangeSetPair frsp( cllNS(), query );
+ BSONObj order = BSON( "$natural" << 1 );
+ QueryPlan qp( nsd, -1, frsp, &frsp, query, order );
+ FindingStartCursor fsc( qp );
+ ASSERT( !fsc.done() );
+ fsc.next();
+ ASSERT( !fsc.done() );
+ ASSERT( fsc.prepareToYield() );
+ ClientCursor::invalidate( "local.oplog.$main" );
+ ASSERT_EXCEPTION( fsc.recoverFromYield(), MsgAssertionException );
+ }
+ };
+
class All : public Suite {
public:
All() : Suite( "repl" ) {
@@ -1131,6 +1157,7 @@ namespace ReplTests {
add< DatabaseIgnorerBasic >();
add< DatabaseIgnorerUpdate >();
add< FindingStartCursorStale >();
+ add< FindingStartCursorYield >();
}
} myall;