From 83aeadc506caa67c1e6c23939f946dea25dcfa7e Mon Sep 17 00:00:00 2001 From: evenyag Date: Tue, 14 Mar 2023 14:09:22 +0800 Subject: [PATCH] feat: Region writer wait flush done --- src/storage/src/region/writer.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/storage/src/region/writer.rs b/src/storage/src/region/writer.rs index a8a1e0094f..8f9e529490 100644 --- a/src/storage/src/region/writer.rs +++ b/src/storage/src/region/writer.rs @@ -266,7 +266,14 @@ impl RegionWriter { ensure!(!inner.is_closed(), error::ClosedRegionSnafu); - inner.manual_flush(writer_ctx).await + inner.manual_flush(writer_ctx).await?; + + // Wait flush. + if let Some(handle) = inner.flush_handle.take() { + handle.join().await?; + } + + Ok(()) } /// Cancel flush task if any