diff options
author | Matthew Saltz <matthew.saltz@mongodb.com> | 2018-04-20 12:30:42 -0400 |
---|---|---|
committer | Matthew Saltz <matthew.saltz@mongodb.com> | 2018-04-23 13:37:12 -0400 |
commit | 4af95dc93dbe306778e94f1d487f4e9afa57c8a9 (patch) | |
tree | 0e800a1ac06630d093dcf593eed81f169b1ccbb4 | |
parent | 0e85602411f0bf38af7eb0efe816d0ca0c58b0c8 (diff) | |
download | mongo-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.cpp | 9 |
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(); } } |