diff --git a/be/src/storage/tablet_updates.cpp b/be/src/storage/tablet_updates.cpp index 95a126d690f31..62fb8e3241530 100644 --- a/be/src/storage/tablet_updates.cpp +++ b/be/src/storage/tablet_updates.cpp @@ -1862,9 +1862,13 @@ Status TabletUpdates::_do_compaction(std::unique_ptr* pinfo) { // 4. commit compaction EditVersion version; RETURN_IF_ERROR(_commit_compaction(pinfo, *output_rowset, &version)); - // already committed, so we can ignore timeout error here - std::unique_lock ul(_lock); - RETURN_IF_ERROR(_wait_for_version(version, 120000, ul)); + { + // already committed, so we can ignore timeout error here + std::unique_lock ul(_lock); + RETURN_IF_ERROR(_wait_for_version(version, 120000, ul)); + } + // Release metadata memory after rowsets have been compacted. + Rowset::close_rowsets(input_rowsets); return Status::OK(); }