Skip to content

Commit

Permalink
[GLUTEN-3509][CH]Fix partition lock problems in shuffle write
Browse files Browse the repository at this point in the history
What changes were proposed in this pull request?
(Please fill in changes proposed in this fix)

(Fixes: #3509)

How was this patch tested?
manual tests

(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)
  • Loading branch information
KevinyhZou authored Oct 26, 2023
1 parent 9cd88de commit 84b56e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cpp-ch/local-engine/Shuffle/PartitionWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,8 @@ void CelebornPartitionWriter::stop()

void Partition::addBlock(DB::Block & block)
{
std::unique_lock<std::mutex> lock(mtx, std::try_to_lock);
if (lock.owns_lock())
blocks.emplace_back(std::move(block));
std::unique_lock<std::mutex> lock(mtx);
blocks.emplace_back(std::move(block));
}

bool Partition::empty() const
Expand All @@ -313,6 +312,7 @@ size_t Partition::spill(DB::NativeWriter & writer)
{
raw_size += writer.write(block);
}
blocks.clear();
return raw_size;
}
else
Expand Down

0 comments on commit 84b56e8

Please sign in to comment.