summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-05-13 11:02:08 -0700
committerAaron <aaron@10gen.com>2010-05-13 11:02:08 -0700
commit9243ee9097940afd7dcc8aa92e1bf01948ec3665 (patch)
treee87b6c54b4566f6684ae70a90b8df04f2f8fb19c
parent598ef8ba63003776aad5cce9d85814f529e1306c (diff)
downloadmongo-9243ee9097940afd7dcc8aa92e1bf01948ec3665.tar.gz
SERVER-1113 (forgot to add file)
-rw-r--r--db/repl.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/db/repl.h b/db/repl.h
index a42fa8e25fb..eb1cb26c045 100644
--- a/db/repl.h
+++ b/db/repl.h
@@ -427,7 +427,7 @@ namespace mongo {
auto_ptr< Cursor > _c;
DiskLoc startLoc( const DiskLoc &rec ) {
Extent *e = rec.rec()->myExtent( rec );
- if ( e->myLoc != _qp.nsd()->capExtent )
+ if ( !_qp.nsd()->capLooped() || ( e->myLoc != _qp.nsd()->capExtent ) )
return e->firstRecord;
// Likely we are on the fresh side of capExtent, so return first fresh record.
// If we are on the stale side of capExtent, then the collection is small and it
@@ -435,14 +435,22 @@ namespace mongo {
return _qp.nsd()->capFirstNewRecord;
}
+ // should never have an empty extent in the oplog, so don't worry about that case
DiskLoc prevLoc( const DiskLoc &rec ) {
Extent *e = rec.rec()->myExtent( rec );
- if ( e->xprev.isNull() )
- e = _qp.nsd()->lastExtent.ext();
- else
- e = e->xprev.ext();
- if ( e->myLoc != _qp.nsd()->capExtent )
- return e->firstRecord;
+ if ( _qp.nsd()->capLooped() ) {
+ if ( e->xprev.isNull() )
+ e = _qp.nsd()->lastExtent.ext();
+ else
+ e = e->xprev.ext();
+ if ( e->myLoc != _qp.nsd()->capExtent )
+ return e->firstRecord;
+ } else {
+ if ( !e->xprev.isNull() ) {
+ e = e->xprev.ext();
+ return e->firstRecord;
+ }
+ }
return DiskLoc(); // reached beginning of collection
}
void createClientCursor( const DiskLoc &startLoc = DiskLoc() ) {