diff --git a/be/src/runtime/load_stream.cpp b/be/src/runtime/load_stream.cpp index e283fdb73ccafb5..38bcf854ae6b684 100644 --- a/be/src/runtime/load_stream.cpp +++ b/be/src/runtime/load_stream.cpp @@ -190,7 +190,11 @@ Status TabletStream::close() { if (!_failed_st->ok()) { return *_failed_st; } - return _load_stream_writer->close(); + Status st = Status::OK(); + auto close_func = [this, &st]() { st = _load_stream_writer->close(); }; + RETURN_IF_ERROR(_flush_tokens[0]->submit_func(close_func)); + _flush_tokens[0]->wait(); + return st; } IndexStream::IndexStream(PUniqueId load_id, int64_t id, int64_t txn_id,