summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Saltz <matthew.saltz@mongodb.com>2018-04-20 12:30:42 -0400
committerMatthew Saltz <matthew.saltz@mongodb.com>2018-04-23 13:37:12 -0400
commit4af95dc93dbe306778e94f1d487f4e9afa57c8a9 (patch)
tree0e800a1ac06630d093dcf593eed81f169b1ccbb4
parent0e85602411f0bf38af7eb0efe816d0ca0c58b0c8 (diff)
downloadmongo-4af95dc93dbe306778e94f1d487f4e9afa57c8a9.tar.gz
SERVER-34571 Ensure _deleteNotifyExec in MigrationChunkClonerSourceLegacy always reset on cleanup
(cherry picked from commit 179985c786cea234b65946ff647debfdfdbed511)
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
index ea83fa83d0d..35520a22c10 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
@@ -473,12 +473,17 @@ void MigrationChunkClonerSourceLegacy::_cleanup(OperationContext* txn) {
_reload.clear();
_deleted.clear();
}
+ // Implicitly resets _deleteNotifyExec to avoid possible invariant failure
+ // in on destruction of MigrationChunkClonerSourceLegacy, and will always
+ // call deleteNotifyExec destructor on scope exit even if something in the
+ // below if statement fails
+ auto deleteNotifyExec = std::move(_deleteNotifyExec);
- if (_deleteNotifyExec) {
+ if (deleteNotifyExec) {
ScopedTransaction scopedXact(txn, MODE_IS);
AutoGetCollection autoColl(txn, _args.getNss(), MODE_IS);
- _deleteNotifyExec.reset();
+ deleteNotifyExec.reset();
}
}