From 976212ede469a44adf26b85c5e972cbf37f505b9 Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Thu, 26 Jul 2018 11:03:44 -0700 Subject: [PATCH] DBImpl::IngestExternalFile() should grab mutex when releasing file number in failure case (#4189) Summary: 995fcf757319da9cf12eca2df83a6fba4db0ebe4 has a bug: ReleaseFileNumberFromPendingOutputs() added is not protected by the DB mutex. Fix it by grabbing the lock for this operation. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4189 Differential Revision: D9015447 Pulled By: siying fbshipit-source-id: b8506e09a96c3f95a6fe32b5ca5fcdb9bee88937 --- db/db_impl.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index 23f990c41..0088ee56d 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -2912,6 +2912,7 @@ Status DBImpl::IngestExternalFile( status = ingestion_job.Prepare(external_files, super_version); CleanupSuperVersion(super_version); if (!status.ok()) { + InstrumentedMutexLock l(&mutex_); ReleaseFileNumberFromPendingOutputs(pending_output_elem); return status; }