diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2021-02-11 11:28:13 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-21 11:29:04 +0000 |
commit | d01febfefb28d3aab5305eb1dbcd6d047139c654 (patch) | |
tree | de0f45a2c56eb9d5dfb8751837aaba6766872d25 /src/mongo/s/cluster_write.h | |
parent | 5199abc5b9113e310a79d9ec29a5ac6b77ad5682 (diff) | |
download | mongo-d01febfefb28d3aab5305eb1dbcd6d047139c654.tar.gz |
SERVER-52812 Unify the implicit createDatabase/enableSharding flow
This change makes both enableSharding and the implicit createDatabase
from the routers to go through the same _configsvrCreateDatabase
command. This command has the sole responsibility now of creating (or
ensuring it is created) a database with the specified name, optional
primary flag and optional enableSharding field.
Diffstat (limited to 'src/mongo/s/cluster_write.h')
-rw-r--r-- | src/mongo/s/cluster_write.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mongo/s/cluster_write.h b/src/mongo/s/cluster_write.h new file mode 100644 index 00000000000..66333aefe9b --- /dev/null +++ b/src/mongo/s/cluster_write.h @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2018-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. + */ + +#pragma once + +#include "mongo/s/write_ops/batch_write_exec.h" + +namespace mongo { +namespace cluster { + +/** + * If 'targetEpoch' is set, throws a 'StaleEpoch' error if the targeted namespace is found to no + * longer have the epoch given by 'targetEpoch'. + */ +void write(OperationContext* opCtx, + const BatchedCommandRequest& request, + BatchWriteExecStats* stats, + BatchedCommandResponse* response, + boost::optional<OID> targetEpoch = boost::none); + +} // namespace cluster +} // namespace mongo |