1
0
Fork 0

prevent lock from being moved from one thread to another

This commit is contained in:
jsteemann 2016-02-06 00:37:32 +01:00
parent c7401910e0
commit 371a9fd046
1 changed files with 11 additions and 0 deletions

View File

@ -57,6 +57,7 @@ CollectionExport::~CollectionExport() {
_ditch->ditches()->freeDocumentDitch(_ditch, false);
}
// if not already done
delete _guard;
}
@ -136,4 +137,14 @@ void CollectionExport::run(uint64_t maxWaitTime, size_t limit) {
trx.finish(res);
}
// delete guard right now as we're about to return
// if we would continue holding the guard's collection lock and return,
// and the export object gets later freed in a different thread, then all
// would be lost. so we'll release the lock here and rely on the cleanup
// thread not unloading the collection (as we've acquired a document ditch
// for the collection already - this will prevent unloading of the collection's
// datafiles etc.)
delete _guard;
_guard = nullptr;
}