diff options
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r-- | src/mongo/db/index/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/index/index_access_method.cpp | 18 | ||||
-rw-r--r-- | src/mongo/db/index/index_access_method.h | 3 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/mongo/db/index/SConscript b/src/mongo/db/index/SConscript index e8e12550fb6..b4e2e698104 100644 --- a/src/mongo/db/index/SConscript +++ b/src/mongo/db/index/SConscript @@ -104,6 +104,7 @@ serveronlyEnv.Library( '$BUILD_DIR/mongo/db/curop', '$BUILD_DIR/mongo/db/multi_key_path_tracker', '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface', + '$BUILD_DIR/mongo/db/resumable_index_builds_idl', '$BUILD_DIR/mongo/db/service_context', '$BUILD_DIR/mongo/db/sorter/sorter_idl', '$BUILD_DIR/mongo/db/storage/encryption_hooks', diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp index d291efd6105..aa0f401c91c 100644 --- a/src/mongo/db/index/index_access_method.cpp +++ b/src/mongo/db/index/index_access_method.cpp @@ -604,7 +604,7 @@ public: bool isMultikey() const final; - void persistDataForShutdown(BSONObjBuilder& builder) final; + IndexStateInfo persistDataForShutdown() final; private: void _yield(OperationContext* opCtx, @@ -745,20 +745,16 @@ bool SortedDataIndexAccessMethod::BulkBuilderImpl::isMultikey() const { return _isMultiKey; } -void SortedDataIndexAccessMethod::BulkBuilderImpl::persistDataForShutdown(BSONObjBuilder& builder) { +IndexStateInfo SortedDataIndexAccessMethod::BulkBuilderImpl::persistDataForShutdown() { _insertMultikeyMetadataKeysIntoSorter(); auto state = _sorter->persistDataForShutdown(); - builder.append("fileName", state.fileName); - builder.append("numKeys", _keysInserted); + IndexStateInfo stateInfo; + stateInfo.setFileName(StringData(state.fileName)); + stateInfo.setNumKeys(_keysInserted); + stateInfo.setRanges(std::move(state.ranges)); - BSONArrayBuilder ranges(builder.subarrayStart("ranges")); - for (const auto& rangeInfo : state.ranges) { - BSONObjBuilder range(ranges.subobjStart()); - range.append("startOffset", rangeInfo.getStartOffset()); - range.append("endOffset", rangeInfo.getEndOffset()); - range.append("checksum", rangeInfo.getChecksum()); - } + return stateInfo; } void SortedDataIndexAccessMethod::BulkBuilderImpl::_insertMultikeyMetadataKeysIntoSorter() { diff --git a/src/mongo/db/index/index_access_method.h b/src/mongo/db/index/index_access_method.h index 2fe9efc1778..c9e85ff5d43 100644 --- a/src/mongo/db/index/index_access_method.h +++ b/src/mongo/db/index/index_access_method.h @@ -217,9 +217,8 @@ public: /** * Persists on disk the keys that have been inserted using this BulkBuilder. - * Appends necessary information to resume building to passed-in builder. */ - virtual void persistDataForShutdown(BSONObjBuilder& builder) = 0; + virtual IndexStateInfo persistDataForShutdown() = 0; }; /** |