diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mongo/db/repl/collection_cloner.cpp | 7 | ||||
| -rw-r--r-- | src/mongo/db/repl/database_cloner.cpp | 4 | ||||
| -rw-r--r-- | src/mongo/db/repl/oplog.cpp | 29 | ||||
| -rw-r--r-- | src/mongo/db/storage/kv/kv_engine.h | 2 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine.h | 2 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine_impl.cpp | 2 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine_impl.h | 2 | ||||
| -rw-r--r-- | src/mongo/db/storage/storage_engine_mock.h | 3 | ||||
| -rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 2 | ||||
| -rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h | 2 |
10 files changed, 17 insertions, 38 deletions
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp index 8a395d09f72..e144dfb6d05 100644 --- a/src/mongo/db/repl/collection_cloner.cpp +++ b/src/mongo/db/repl/collection_cloner.cpp @@ -229,10 +229,9 @@ BaseCloner::AfterStageBehavior CollectionCloner::listIndexesStage() { auto sanitizedStorageEngineOpts = storageEngine->getSanitizedStorageOptionsForSecondaryReplication( storageEngineElem.embeddedObject()); - fassert(6812200, sanitizedStorageEngineOpts); - spec = spec.addField(BSON(IndexDescriptor::kStorageEngineFieldName - << sanitizedStorageEngineOpts.getValue()) - .firstElement()); + spec = spec.addField( + BSON(IndexDescriptor::kStorageEngineFieldName << sanitizedStorageEngineOpts) + .firstElement()); } if (spec.hasField("buildUUID")) { diff --git a/src/mongo/db/repl/database_cloner.cpp b/src/mongo/db/repl/database_cloner.cpp index 88b3aead08e..4c2bb926dc0 100644 --- a/src/mongo/db/repl/database_cloner.cpp +++ b/src/mongo/db/repl/database_cloner.cpp @@ -112,8 +112,8 @@ BaseCloner::AfterStageBehavior DatabaseCloner::listCollectionsStage() { // Sanitize storage engine options to remove options which might not apply to this node. See // SERVER-68122. auto sanitizedStorageOptions = - uassertStatusOK(storageEngine->getSanitizedStorageOptionsForSecondaryReplication( - result.getOptions().storageEngine)); + storageEngine->getSanitizedStorageOptionsForSecondaryReplication( + result.getOptions().storageEngine); result.getOptions().storageEngine = sanitizedStorageOptions; // While UUID is a member of CollectionOptions, listCollections does not return the diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 06001d4f7fc..967a2f10783 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -726,19 +726,14 @@ NamespaceString extractNsFromUUIDorNs(OperationContext* opCtx, return ui ? extractNsFromUUID(opCtx, ui.get()) : extractNs(ns, cmd); } -StatusWith<BSONObj> getObjWithSanitizedStorageEngineOptions(OperationContext* opCtx, - const BSONObj& cmd) { +BSONObj getObjWithSanitizedStorageEngineOptions(OperationContext* opCtx, const BSONObj& cmd) { if (auto storageEngineElem = cmd[IndexDescriptor::kStorageEngineFieldName]) { auto storageEngine = opCtx->getServiceContext()->getStorageEngine(); auto engineObj = storageEngineElem.embeddedObject(); auto sanitizedObj = storageEngine->getSanitizedStorageOptionsForSecondaryReplication(engineObj); - if (!sanitizedObj.isOK()) { - return sanitizedObj.getStatus(); - } return cmd.addField( - BSON(IndexDescriptor::kStorageEngineFieldName << sanitizedObj.getValue()) - .firstElement()); + BSON(IndexDescriptor::kStorageEngineFieldName << sanitizedObj).firstElement()); } return cmd; } @@ -766,12 +761,7 @@ const StringMap<ApplyOpMetadata> kOpsMap = { const auto& ui = entry.getUuid(); // Sanitize storage engine options to remove options which might not apply to this node. // See SERVER-68122. - const auto sanitizedCmdOrStatus = - getObjWithSanitizedStorageEngineOptions(opCtx, entry.getObject()); - if (!sanitizedCmdOrStatus.isOK()) { - return sanitizedCmdOrStatus.getStatus(); - } - const auto& cmd = sanitizedCmdOrStatus.getValue(); + const auto cmd = getObjWithSanitizedStorageEngineOptions(opCtx, entry.getObject()); const NamespaceString nss(extractNs(entry.getNss(), cmd)); // Mode SECONDARY steady state replication should not allow create collection to rename an @@ -811,12 +801,7 @@ const StringMap<ApplyOpMetadata> kOpsMap = { {[](OperationContext* opCtx, const OplogEntry& entry, OplogApplication::Mode mode) -> Status { // Sanitize storage engine options to remove options which might not apply to this node. // See SERVER-68122. - const auto sanitizedCmdOrStatus = - getObjWithSanitizedStorageEngineOptions(opCtx, entry.getObject()); - if (!sanitizedCmdOrStatus.isOK()) { - return sanitizedCmdOrStatus.getStatus(); - } - const auto& cmd = sanitizedCmdOrStatus.getValue(); + const auto cmd = getObjWithSanitizedStorageEngineOptions(opCtx, entry.getObject()); if (OplogApplication::Mode::kApplyOpsCmd == mode && IndexBuildsCoordinator::supportsTwoPhaseIndexBuild()) { @@ -860,11 +845,7 @@ const StringMap<ApplyOpMetadata> kOpsMap = { // Sanitize storage engine options to remove options which might not apply to this node. // See SERVER-68122. for (auto& spec : swOplogEntry.getValue().indexSpecs) { - auto sanitizedObj = getObjWithSanitizedStorageEngineOptions(opCtx, spec); - if (!sanitizedObj.isOK()) { - return swOplogEntry.getStatus(); - } - spec = sanitizedObj.getValue(); + spec = getObjWithSanitizedStorageEngineOptions(opCtx, spec); } IndexBuildsCoordinator::ApplicationMode applicationMode = diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h index fb91ca8b95e..f76261e1051 100644 --- a/src/mongo/db/storage/kv/kv_engine.h +++ b/src/mongo/db/storage/kv/kv_engine.h @@ -477,7 +477,7 @@ public: * this node, such as encryption. Might be called for both collection and index options. See * SERVER-68122. */ - virtual StatusWith<BSONObj> getSanitizedStorageOptionsForSecondaryReplication( + virtual BSONObj getSanitizedStorageOptionsForSecondaryReplication( const BSONObj& options) const { return options; } diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h index 1a5514c100b..df922e2a1fd 100644 --- a/src/mongo/db/storage/storage_engine.h +++ b/src/mongo/db/storage/storage_engine.h @@ -647,7 +647,7 @@ public: * this node, such as encryption. Might be called for both collection and index options. See * SERVER-68122. */ - virtual StatusWith<BSONObj> getSanitizedStorageOptionsForSecondaryReplication( + virtual BSONObj getSanitizedStorageOptionsForSecondaryReplication( const BSONObj& options) const = 0; }; diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp index 056c52967cb..9732f22580d 100644 --- a/src/mongo/db/storage/storage_engine_impl.cpp +++ b/src/mongo/db/storage/storage_engine_impl.cpp @@ -1132,7 +1132,7 @@ void StorageEngineImpl::setPinnedOplogTimestamp(const Timestamp& pinnedTimestamp _engine->setPinnedOplogTimestamp(pinnedTimestamp); } -StatusWith<BSONObj> StorageEngineImpl::getSanitizedStorageOptionsForSecondaryReplication( +BSONObj StorageEngineImpl::getSanitizedStorageOptionsForSecondaryReplication( const BSONObj& options) const { return _engine->getSanitizedStorageOptionsForSecondaryReplication(options); } diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h index 7608b708e8a..6abf006e75f 100644 --- a/src/mongo/db/storage/storage_engine_impl.h +++ b/src/mongo/db/storage/storage_engine_impl.h @@ -361,7 +361,7 @@ public: void setPinnedOplogTimestamp(const Timestamp& pinnedTimestamp) override; - StatusWith<BSONObj> getSanitizedStorageOptionsForSecondaryReplication( + BSONObj getSanitizedStorageOptionsForSecondaryReplication( const BSONObj& options) const override; private: diff --git a/src/mongo/db/storage/storage_engine_mock.h b/src/mongo/db/storage/storage_engine_mock.h index b52f8e7c967..b96fe1cdf08 100644 --- a/src/mongo/db/storage/storage_engine_mock.h +++ b/src/mongo/db/storage/storage_engine_mock.h @@ -194,8 +194,7 @@ public: void setPinnedOplogTimestamp(const Timestamp& pinnedTimestamp) final {} - StatusWith<BSONObj> getSanitizedStorageOptionsForSecondaryReplication( - const BSONObj& options) const final { + BSONObj getSanitizedStorageOptionsForSecondaryReplication(const BSONObj& options) const final { return options; } }; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 2dce94a6ef5..b94e60858bb 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -2348,7 +2348,7 @@ std::uint64_t WiredTigerKVEngine::_getCheckpointTimestamp() const { return tmp; } -StatusWith<BSONObj> WiredTigerKVEngine::getSanitizedStorageOptionsForSecondaryReplication( +BSONObj WiredTigerKVEngine::getSanitizedStorageOptionsForSecondaryReplication( const BSONObj& options) const { // Skip inMemory storage engine, encryption at rest only applies to storage backed engine. diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index e48db10d5ac..1493bf15f82 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -348,7 +348,7 @@ public: void setPinnedOplogTimestamp(const Timestamp& pinnedTimestamp) override; - StatusWith<BSONObj> getSanitizedStorageOptionsForSecondaryReplication( + BSONObj getSanitizedStorageOptionsForSecondaryReplication( const BSONObj& options) const override; private: |
