Bug: paralle_group status updated in WriteThread::CompleteParallelWorker

Summary:
Multi-write thread may update the status of the parallel_group in
WriteThread::CompleteParallelWorker if the status of Writer is not ok!
When copy write status to the paralle_group, the write thread just hold the
mutex of the the writer processed by itself. it is useless. The thread
should held the the leader of the parallel_group instead.
Closes https://github.com/facebook/rocksdb/pull/1598

Differential Revision: D4252335

Pulled By: siying

fbshipit-source-id: 3864cf7
This commit is contained in:
fangchenliaohui 2016-12-01 09:46:43 -08:00 committed by Facebook Github Bot
parent 247d0979aa
commit b77007df8b

View File

@ -333,7 +333,7 @@ bool WriteThread::CompleteParallelWorker(Writer* w) {
auto* pg = w->parallel_group; auto* pg = w->parallel_group;
if (!w->status.ok()) { if (!w->status.ok()) {
std::lock_guard<std::mutex> guard(w->StateMutex()); std::lock_guard<std::mutex> guard(pg->leader->StateMutex());
pg->status = w->status; pg->status = w->status;
} }