summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/skipped_record_tracker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/index/skipped_record_tracker.cpp')
-rw-r--r--src/mongo/db/index/skipped_record_tracker.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/db/index/skipped_record_tracker.cpp b/src/mongo/db/index/skipped_record_tracker.cpp
index 9fd39f158aa..0c32261e1d2 100644
--- a/src/mongo/db/index/skipped_record_tracker.cpp
+++ b/src/mongo/db/index/skipped_record_tracker.cpp
@@ -41,6 +41,25 @@ namespace {
static constexpr StringData kRecordIdField = "recordId"_sd;
}
+SkippedRecordTracker::SkippedRecordTracker(IndexCatalogEntry* indexCatalogEntry) {
+ SkippedRecordTracker(nullptr, indexCatalogEntry, boost::none);
+}
+
+SkippedRecordTracker::SkippedRecordTracker(OperationContext* opCtx,
+ IndexCatalogEntry* indexCatalogEntry,
+ boost::optional<StringData> ident)
+ : _indexCatalogEntry(indexCatalogEntry) {
+ if (!ident) {
+ return;
+ }
+
+ // Only initialize the table when resuming an index build if an ident already exists. Otherwise,
+ // lazily initialize table when we record the first document.
+ _skippedRecordsTable =
+ opCtx->getServiceContext()->getStorageEngine()->makeTemporaryRecordStoreFromExistingIdent(
+ opCtx, ident.get());
+}
+
void SkippedRecordTracker::finalizeTemporaryTable(OperationContext* opCtx,
TemporaryRecordStore::FinalizationAction action) {
if (_skippedRecordsTable) {