diff options
author | Kristina <kristina@10gen.com> | 2012-10-04 10:06:12 -0400 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2012-10-04 10:06:33 -0400 |
commit | 3b754792b2d5e3e6bc7b675ecd08e4c6ad83ecba (patch) | |
tree | 3180bc3642b98b83797c64ec8791041f718f1448 /src/mongo/db/repl/rs_sync.h | |
parent | c551b8114d7f9ae97ae5d1985be375981365a053 (diff) | |
download | mongo-3b754792b2d5e3e6bc7b675ecd08e4c6ad83ecba.tar.gz |
SERVER-7199 Bump minvalid correctly when batch goes past minvalid
Diffstat (limited to 'src/mongo/db/repl/rs_sync.h')
-rw-r--r-- | src/mongo/db/repl/rs_sync.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/mongo/db/repl/rs_sync.h b/src/mongo/db/repl/rs_sync.h index cc86b3049e8..47f9c6886fc 100644 --- a/src/mongo/db/repl/rs_sync.h +++ b/src/mongo/db/repl/rs_sync.h @@ -39,9 +39,31 @@ namespace replset { SyncTail(BackgroundSyncInterface *q); virtual ~SyncTail(); virtual bool syncApply(const BSONObj &o, bool convertUpdateToUpsert = false); - void oplogApplySegment(const BSONObj& applyGTEObj, const BSONObj& minValidObj, + + /** + * Apply ops from applyGTEObj's ts to at least minValidObj's ts. Note that, due to + * batching, this may end up applying ops beyond minValidObj's ts. + * + * @param applyGTEObj the op to start replicating at. This is actually not used except in + * comparision to minValidObj: the background sync thread keeps its own + * record of where we're synced to and starts providing ops from that + * point. + * @param minValidObj the op to finish syncing at. This function cannot return (other than + * fatally erroring out) without applying at least this op. + * @param func whether this should use initial sync logic (recloning docs) or + * "normal" logic. + * @return BSONObj the op that was synced to. This may be greater than minValidObj, as a + * single batch might blow right by minvalid. If applyGTEObj is the same + * op as minValidObj, this will be applyGTEObj. + */ + BSONObj oplogApplySegment(const BSONObj& applyGTEObj, const BSONObj& minValidObj, MultiSyncApplyFunc func); - virtual void oplogApplication(const BSONObj& applyGTEObj, const BSONObj& minValidObj); + + /** + * Runs oplogApplySegment without allowing recloning documents. + */ + virtual BSONObj oplogApplication(const BSONObj& applyGTEObj, const BSONObj& minValidObj); + void oplogApplication(); bool peek(BSONObj* obj); @@ -108,7 +130,12 @@ namespace replset { public: virtual ~InitialSync(); InitialSync(BackgroundSyncInterface *q); - void oplogApplication(const BSONObj& applyGTEObj, const BSONObj& minValidObj); + + /** + * Creates the initial oplog entry: applies applyGTEObj and writes it to the oplog. Then + * this runs oplogApplySegment allowing recloning documents. + */ + BSONObj oplogApplication(const BSONObj& applyGTEObj, const BSONObj& minValidObj); }; // TODO: move hbmsg into an error-keeping class (SERVER-4444) |