Skip to content

Commit

Permalink
Merge pull request ClickHouse#66138 from ClickHouse/fix_smt_sink
Browse files Browse the repository at this point in the history
Finalize MergedBlockOutputStream in dtor
  • Loading branch information
nickitat authored Jul 8, 2024
2 parents a9546fe + 8a7dfa7 commit 2c3a8e2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Storages/MergeTree/MergedBlockOutputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct MergedBlockOutputStream::Finalizer::Impl
void MergedBlockOutputStream::Finalizer::finish()
{
std::unique_ptr<Impl> to_finish = std::move(impl);
impl.reset();
if (to_finish)
to_finish->finish();
}
Expand Down Expand Up @@ -130,7 +131,19 @@ MergedBlockOutputStream::Finalizer::Finalizer(Finalizer &&) noexcept = default;
MergedBlockOutputStream::Finalizer & MergedBlockOutputStream::Finalizer::operator=(Finalizer &&) noexcept = default;
MergedBlockOutputStream::Finalizer::Finalizer(std::unique_ptr<Impl> impl_) : impl(std::move(impl_)) {}

MergedBlockOutputStream::Finalizer::~Finalizer() = default;
MergedBlockOutputStream::Finalizer::~Finalizer()
{
try
{
if (impl)
finish();
}
catch (...)
{
tryLogCurrentException(__PRETTY_FUNCTION__);
}
}


void MergedBlockOutputStream::finalizePart(
const MergeTreeMutableDataPartPtr & new_part,
Expand Down

0 comments on commit 2c3a8e2

Please sign in to comment.