diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2022-05-20 06:39:57 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-20 07:59:22 +0000 |
commit | 1391cc6cdd8968ee8ce4336a0d566e76906efcc5 (patch) | |
tree | 93fc4e2ad5fd2e5a705d63583acf82c7cdccef9b /src/mongo/db/change_stream_change_collection_manager.cpp | |
parent | 25c36e3fee2303b41a8ca60acd4a07b62c45725e (diff) | |
download | mongo-1391cc6cdd8968ee8ce4336a0d566e76906efcc5.tar.gz |
Revert "SERVER-65209 Skeleton code to create change collection."
This reverts commit f76ed79b1fe31c0f22bad3590699c2658638681d.
Diffstat (limited to 'src/mongo/db/change_stream_change_collection_manager.cpp')
-rw-r--r-- | src/mongo/db/change_stream_change_collection_manager.cpp | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/src/mongo/db/change_stream_change_collection_manager.cpp b/src/mongo/db/change_stream_change_collection_manager.cpp deleted file mode 100644 index 481cf6e664d..00000000000 --- a/src/mongo/db/change_stream_change_collection_manager.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright (C) 2022-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kQuery - -#include "mongo/platform/basic.h" - -#include "mongo/db/change_stream_change_collection_manager.h" - -#include "mongo/db/catalog/clustered_collection_util.h" -#include "mongo/db/catalog/coll_mod.h" -#include "mongo/db/catalog/create_collection.h" -#include "mongo/db/catalog/drop_collection.h" -#include "mongo/db/namespace_string.h" -#include "mongo/logv2/log.h" - -namespace mongo { -namespace { -const auto getChangeCollectionManager = - ServiceContext::declareDecoration<boost::optional<ChangeStreamChangeCollectionManager>>(); -} // namespace - -ChangeStreamChangeCollectionManager& ChangeStreamChangeCollectionManager::get( - ServiceContext* service) { - return *getChangeCollectionManager(service); -} - -ChangeStreamChangeCollectionManager& ChangeStreamChangeCollectionManager::get( - OperationContext* opCtx) { - return *getChangeCollectionManager(opCtx->getServiceContext()); -} - -void ChangeStreamChangeCollectionManager::create(ServiceContext* service) { - getChangeCollectionManager(service).emplace(service); -} - -Status ChangeStreamChangeCollectionManager::createChangeCollection( - OperationContext* opCtx, boost::optional<TenantId> tenantId) { - // TODO: SERVER-65950 create or update the change collection for a particular tenant. - const NamespaceString nss{NamespaceString::kConfigDb, - NamespaceString::kChangeStreamChangeCollection}; - - // Make the change collection clustered by '_id'. The '_id' field will have the same value as - // the 'ts' field of the oplog. - CollectionOptions changeCollectionOptions; - changeCollectionOptions.clusteredIndex.emplace(clustered_util::makeDefaultClusteredIdIndex()); - - auto status = createCollection(opCtx, nss, changeCollectionOptions, BSONObj()); - if (status.code() == ErrorCodes::NamespaceExists) { - return Status(ErrorCodes::Error::OK, ""); - } - - return status; -} - -Status ChangeStreamChangeCollectionManager::dropChangeCollection( - OperationContext* opCtx, boost::optional<TenantId> tenantId) { - // TODO: SERVER-65950 remove the change collection for a particular tenant. - const NamespaceString nss{NamespaceString::kConfigDb, - NamespaceString::kChangeStreamChangeCollection}; - DropReply dropReply; - return dropCollection( - opCtx, nss, &dropReply, DropCollectionSystemCollectionMode::kAllowSystemCollectionDrops); -} - -Status ChangeStreamChangeCollectionManager::insertDocumentsToChangeCollection( - OperationContext* opCtx, - boost::optional<TenantId> tenantId, - std::vector<Record>* records, - const std::vector<Timestamp>& timestamps) { - // TODO SERVER-65210 add code to insert to the change collection in the primaries. - return Status(ErrorCodes::OK, ""); -} - -} // namespace mongo |