diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 00:22:50 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 10:56:02 -0400 |
commit | 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch) | |
tree | 3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h')
-rw-r--r-- | src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h | 109 |
1 files changed, 53 insertions, 56 deletions
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h index 6b93ad5941a..def5178ad8e 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h @@ -35,63 +35,60 @@ namespace mongo { +/** + * This iterator will go over the collection twice - once going forward (first extent -> last + * extent) and once backwards in an attempt to salvage potentially corrupted or unreachable + * records. It is used by the mongodump --repair option. + */ +class RecordStoreV1RepairCursor final : public RecordCursor { +public: + RecordStoreV1RepairCursor(OperationContext* txn, const RecordStoreV1Base* recordStore); + + boost::optional<Record> next() final; + boost::optional<Record> seekExact(const RecordId& id) final; + void invalidate(const RecordId& dl); + void savePositioned() final { + _txn = nullptr; + } + bool restore(OperationContext* txn) final { + _txn = txn; + return true; + } + + // Explicitly not supporting fetcherForNext(). The expected use case for this class is a + // special offline operation where there are no concurrent operations, so it would be better + // to take the pagefault inline with the operation. + +private: + void advance(); + /** - * This iterator will go over the collection twice - once going forward (first extent -> last - * extent) and once backwards in an attempt to salvage potentially corrupted or unreachable - * records. It is used by the mongodump --repair option. + * Based on the direction of scan, finds the next valid (un-corrupted) extent in the chain + * and sets _currExtent to point to that. + * + * @return true if valid extent was found (_currExtent will not be null) + * false otherwise and _currExtent will be null */ - class RecordStoreV1RepairCursor final : public RecordCursor { - public: - RecordStoreV1RepairCursor(OperationContext* txn, - const RecordStoreV1Base* recordStore); - - boost::optional<Record> next() final; - boost::optional<Record> seekExact(const RecordId& id) final; - void invalidate(const RecordId& dl); - void savePositioned() final { _txn = nullptr; } - bool restore(OperationContext* txn) final { - _txn = txn; - return true; - } - - // Explicitly not supporting fetcherForNext(). The expected use case for this class is a - // special offline operation where there are no concurrent operations, so it would be better - // to take the pagefault inline with the operation. - - private: - void advance(); - - /** - * Based on the direction of scan, finds the next valid (un-corrupted) extent in the chain - * and sets _currExtent to point to that. - * - * @return true if valid extent was found (_currExtent will not be null) - * false otherwise and _currExtent will be null - */ - bool _advanceToNextValidExtent(); - - // transactional context for read locks. Not owned by us - OperationContext* _txn; - - // Reference to the owning RecordStore. The store must not be deleted while there are - // active iterators on it. - // - const RecordStoreV1Base* _recordStore; - - DiskLoc _currExtent; - DiskLoc _currRecord; - - enum Stage { - FORWARD_SCAN = 0, - BACKWARD_SCAN = 1, - DONE = 2 - }; - - Stage _stage; - - // Used to find cycles within an extent. Cleared after each extent has been processed. - // - std::set<DiskLoc> _seenInCurrentExtent; - }; + bool _advanceToNextValidExtent(); + + // transactional context for read locks. Not owned by us + OperationContext* _txn; + + // Reference to the owning RecordStore. The store must not be deleted while there are + // active iterators on it. + // + const RecordStoreV1Base* _recordStore; + + DiskLoc _currExtent; + DiskLoc _currRecord; + + enum Stage { FORWARD_SCAN = 0, BACKWARD_SCAN = 1, DONE = 2 }; + + Stage _stage; + + // Used to find cycles within an extent. Cleared after each extent has been processed. + // + std::set<DiskLoc> _seenInCurrentExtent; +}; } // namespace mongo |