summaryrefslogtreecommitdiff
path: root/src/mongo/db/user_write_block_mode_op_observer.h
diff options
context:
space:
mode:
authorGabriel Marks <gabriel.marks@mongodb.com>2022-04-11 14:31:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-11 20:33:45 +0000
commit25377181476e4140c970afa5b018f9b4fcc951e8 (patch)
tree90fba94f67a0b140b0b03fae5d733a79800fea43 /src/mongo/db/user_write_block_mode_op_observer.h
parent6cbfcc07937a9bc2f4ea20e242a912fd5868647d (diff)
downloadmongo-25377181476e4140c970afa5b018f9b4fcc951e8.tar.gz
SERVER-65116 Abort active index builds when write blocking is enabled
Diffstat (limited to 'src/mongo/db/user_write_block_mode_op_observer.h')
-rw-r--r--src/mongo/db/user_write_block_mode_op_observer.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mongo/db/user_write_block_mode_op_observer.h b/src/mongo/db/user_write_block_mode_op_observer.h
index 5c3e21f12b9..330779d0cd6 100644
--- a/src/mongo/db/user_write_block_mode_op_observer.h
+++ b/src/mongo/db/user_write_block_mode_op_observer.h
@@ -79,13 +79,6 @@ public:
const std::vector<BSONObj>& indexes,
bool fromMigrate) final;
- void onCommitIndexBuild(OperationContext* opCtx,
- const NamespaceString& nss,
- const UUID& collUUID,
- const UUID& indexBuildUUID,
- const std::vector<BSONObj>& indexes,
- bool fromMigrate) final;
-
void onStartIndexBuildSinglePhase(OperationContext* opCtx, const NamespaceString& nss) final;
void onCreateCollection(OperationContext* opCtx,
@@ -155,6 +148,17 @@ public:
// Noop operations (don't perform any check).
+ // Index builds committing can be left unchecked since we kill any active index builds before
+ // enabling write blocking. This means any index build which gets to the commit phase while
+ // write blocking is active was started and hit the onStartIndexBuild hook with write blocking
+ // active, and thus must be allowed under user write blocking.
+ void onCommitIndexBuild(OperationContext* opCtx,
+ const NamespaceString& nss,
+ const UUID& collUUID,
+ const UUID& indexBuildUUID,
+ const std::vector<BSONObj>& indexes,
+ bool fromMigrate) final {}
+
// At the moment we are leaving the onAbortIndexBuilds as unchecked. This is because they can be
// called from both user and internal codepaths, and we don't want to risk throwing an assert
// for the internal paths.