Storage Engine API
record_store_v1_repair_iterator.h
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #include <set>
32 
35 
36 namespace mongo {
37 
44 public:
46 
47  boost::optional<Record> next() final;
48  void invalidate(OperationContext* opCtx, const RecordId& dl);
49  void save() final {}
50  bool restore() final {
51  return true;
52  }
54  _opCtx = nullptr;
55  }
56  void reattachToOperationContext(OperationContext* opCtx) final {
57  _opCtx = opCtx;
58  }
59 
60  // Explicitly not supporting fetcherForNext(). The expected use case for this class is a
61  // special offline operation where there are no concurrent operations, so it would be better
62  // to take the pagefault inline with the operation.
63 
64 private:
65  void advance();
66 
75 
76  // transactional context for read locks. Not owned by us
77  OperationContext* _opCtx;
78 
79  // Reference to the owning RecordStore. The store must not be deleted while there are
80  // active iterators on it.
81  //
83 
86 
87  enum Stage { FORWARD_SCAN = 0, BACKWARD_SCAN = 1, DONE = 2 };
88 
90 
91  // Used to find cycles within an extent. Cleared after each extent has been processed.
92  //
93  std::set<DiskLoc> _seenInCurrentExtent;
94 };
95 
96 } // namespace mongo
DiskLoc _currRecord
Definition: record_store_v1_repair_iterator.h:85
const RecordStoreV1Base * _recordStore
Definition: record_store_v1_repair_iterator.h:82
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
Definition: record_store_v1_repair_iterator.h:87
void detachFromOperationContext() final
Detaches from the OperationContext and releases any storage-engine state.
Definition: record_store_v1_repair_iterator.h:53
Stage _stage
Definition: record_store_v1_repair_iterator.h:89
void invalidate(OperationContext *opCtx, const RecordId &dl)
Inform the cursor that this id is being invalidated.
Definition: record_store_v1_repair_iterator.cpp:184
Definition: record_store_v1_base.h:152
Definition: record_store_v1_repair_iterator.h:87
DiskLoc _currExtent
Definition: record_store_v1_repair_iterator.h:84
void reattachToOperationContext(OperationContext *opCtx) final
Reattaches to the OperationContext and reacquires any storage-engine state.
Definition: record_store_v1_repair_iterator.h:56
represents a disk location/offset on disk in a database.
Definition: diskloc.h:53
boost::optional< Record > next() final
Moves forward and returns the new data or boost::none if there is no more data.
Definition: record_store_v1_repair_iterator.cpp:51
OperationContext * _opCtx
Definition: record_store_v1_repair_iterator.h:77
Collection *const OperationContext *const const StringData OptionalCollectionUUID CollectionCatalogEntry *const RecordStore *const recordStore
Definition: collection_impl.cpp:80
Definition: record_store_v1_repair_iterator.h:87
This iterator will go over the collection twice - once going forward (first extent -> last extent) an...
Definition: record_store_v1_repair_iterator.h:43
std::set< DiskLoc > _seenInCurrentExtent
Definition: record_store_v1_repair_iterator.h:93
Retrieves Records from a RecordStore.
Definition: record_store.h:141
RecordStoreV1RepairCursor(OperationContext *opCtx, const RecordStoreV1Base *recordStore)
Definition: record_store_v1_repair_iterator.cpp:43
void advance()
Definition: record_store_v1_repair_iterator.cpp:59
void save() final
Prepares for state changes in underlying data in a way that allows the cursor&#39;s current position to b...
Definition: record_store_v1_repair_iterator.h:49
bool _advanceToNextValidExtent()
Based on the direction of scan, finds the next valid (un-corrupted) extent in the chain and sets _cur...
Definition: record_store_v1_repair_iterator.cpp:112
bool restore() final
Recovers from potential state changes in underlying data.
Definition: record_store_v1_repair_iterator.h:50
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
Stage
Definition: record_store_v1_repair_iterator.h:87