summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/config/sharding_catalog_manager.h
diff options
context:
space:
mode:
authorsviatlana_zuiko <sviatlana.zuiko@mongodb.com>2020-11-03 11:14:31 +0300
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-03 11:35:10 +0000
commit787a8b73687a43bbeeea4ea7eeadbf861390253a (patch)
tree1c17be458f1f47a86411a17052d20f86f8eaabac /src/mongo/db/s/config/sharding_catalog_manager.h
parent3518bd82e49b6941ee7a2f3a868df40114b0d8fc (diff)
downloadmongo-787a8b73687a43bbeeea4ea7eeadbf861390253a.tar.gz
Revert "SERVER-51291 Increment shard version when changing original or temporary resharding collection"
This reverts commit 411dab1fa8060e48e11bf67b396be3ff24b94d3b.
Diffstat (limited to 'src/mongo/db/s/config/sharding_catalog_manager.h')
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager.h46
1 files changed, 14 insertions, 32 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager.h b/src/mongo/db/s/config/sharding_catalog_manager.h
index fafcbd62897..a6f97372025 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager.h
+++ b/src/mongo/db/s/config/sharding_catalog_manager.h
@@ -30,9 +30,7 @@
#pragma once
#include "mongo/base/status_with.h"
-#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/concurrency/d_concurrency.h"
-#include "mongo/db/logical_session_cache.h"
#include "mongo/db/repl/optime_with.h"
#include "mongo/db/s/config/namespace_serializer.h"
#include "mongo/executor/task_executor.h"
@@ -185,28 +183,14 @@ public:
*/
Lock::ExclusiveLock lockZoneMutex(OperationContext* opCtx);
- //
- // General utilities related to the ShardingCatalogManager
- //
-
- /**
- * Starts and commits a transaction on the config server, with a no-op find on the specified
- * namespace in order to internally start the transaction. All writes done inside the
- * passed-in function must assume that they are run inside a transaction that will be commited
- * after the function itself has completely finished.
- */
- static void withTransaction(OperationContext* opCtx,
- const NamespaceString& namespaceForInitialFind,
- unique_function<void(OperationContext*, TxnNumber)> func);
-
/**
* Runs the write 'request' on namespace 'nss' in a transaction with 'txnNumber'. Write must be
- * on a collection in the config database. If expectedNumModified is specified, the number of
- * documents modified must match expectedNumModified - throws otherwise.
+ * on a collection in the config database.
*/
BSONObj writeToConfigDocumentInTxn(OperationContext* opCtx,
const NamespaceString& nss,
const BatchedCommandRequest& request,
+ bool startTransaction,
TxnNumber txnNumber);
/**
@@ -217,8 +201,19 @@ public:
void insertConfigDocumentsInTxn(OperationContext* opCtx,
const NamespaceString& nss,
std::vector<BSONObj> docs,
+ bool startTransaction,
TxnNumber txnNumber);
+ /**
+ * Runs commit for the transaction with 'txnNumber'.
+ */
+ void commitTxnForConfigDocument(OperationContext* opCtx, TxnNumber txnNumber);
+
+ /**
+ * Runs abort for the transaction with 'txnNumber'.
+ */
+ void abortTxnForConfigDocument(OperationContext* opCtx, TxnNumber txnNumber);
+
//
// Chunk Operations
//
@@ -288,20 +283,6 @@ public:
const BSONObj& maxKey,
const ChunkVersion& version);
- /**
- * In a single transaction, effectively bumps the shard version for each shard in the collection
- * to be the current collection version's major version + 1 inside an already-running
- * transaction.
- *
- * Note: it's the responsibility of the caller to ensure that the list of shards is stable,
- * as any shards added after the shard ids have been passed in will be missed.
- */
- void bumpCollShardVersionsAndChangeMetadataInTxn(
- OperationContext* opCtx,
- const NamespaceString& nss,
- const std::vector<ShardId>& shardIds,
- unique_function<void(OperationContext*, TxnNumber)> changeMetadataFunc);
-
//
// Database Operations
//
@@ -400,6 +381,7 @@ public:
const NamespaceString& nss,
const CollectionType& coll,
const bool upsert,
+ const bool startTransaction,
TxnNumber txnNumber);
/**