summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/config/sharding_catalog_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/config/sharding_catalog_manager.h')
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager.h b/src/mongo/db/s/config/sharding_catalog_manager.h
index 16772155643..a6f97372025 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager.h
+++ b/src/mongo/db/s/config/sharding_catalog_manager.h
@@ -36,6 +36,7 @@
#include "mongo/executor/task_executor.h"
#include "mongo/platform/mutex.h"
#include "mongo/s/catalog/type_chunk.h"
+#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard.h"
@@ -182,6 +183,37 @@ public:
*/
Lock::ExclusiveLock lockZoneMutex(OperationContext* opCtx);
+ /**
+ * Runs the write 'request' on namespace 'nss' in a transaction with 'txnNumber'. Write must be
+ * on a collection in the config database.
+ */
+ BSONObj writeToConfigDocumentInTxn(OperationContext* opCtx,
+ const NamespaceString& nss,
+ const BatchedCommandRequest& request,
+ bool startTransaction,
+ TxnNumber txnNumber);
+
+ /**
+ * Inserts 'docs' to namespace 'nss' in a transaction with 'txnNumber'. Breaks into multiple
+ * batches if 'docs' is larger than the max batch size. Write must be on a collection in the
+ * config database.
+ */
+ 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
//
@@ -340,6 +372,19 @@ public:
const ShardKeyPattern& newShardKey);
/**
+ * Runs a replacement update on config.collections for the collection entry for 'nss' in a
+ * transaction with 'txnNumber'. 'coll' is used as the replacement doc.
+ *
+ * Throws exception on errors.
+ */
+ void updateShardingCatalogEntryForCollectionInTxn(OperationContext* opCtx,
+ const NamespaceString& nss,
+ const CollectionType& coll,
+ const bool upsert,
+ const bool startTransaction,
+ TxnNumber txnNumber);
+
+ /**
* Creates a ScopedLock on the collection name in _namespaceSerializer. This is to prevent
* timeouts waiting on the dist lock if multiple threads attempt to create or drop the same
* collection.