From 904e5287050660121375c2a652b978290a065d49 Mon Sep 17 00:00:00 2001 From: JinYan Su <751080330@qq.com> Date: Tue, 17 Oct 2023 11:49:33 +0800 Subject: [PATCH] chore: replace read_to_end() (#801) Signed-off-by: xiaguan <751080330@qq.com> --- src/storage/secondary/rowset/disk_rowset.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/storage/secondary/rowset/disk_rowset.rs b/src/storage/secondary/rowset/disk_rowset.rs index e3d11c0e2..a1dd3eccc 100644 --- a/src/storage/secondary/rowset/disk_rowset.rs +++ b/src/storage/secondary/rowset/disk_rowset.rs @@ -6,8 +6,7 @@ use std::sync::{Arc, Mutex}; use bytes::Bytes; use itertools::Itertools; use moka::future::Cache; -use tokio::fs::OpenOptions; -use tokio::io::AsyncReadExt; +use tokio::fs::{read, OpenOptions}; use super::super::{Block, BlockCacheKey, Column, ColumnIndex, ColumnSeekPosition, IOBackend}; use super::{path_of_data_column, path_of_index_column, RowSetIterator}; @@ -42,15 +41,8 @@ impl DiskRowset { let index_content = match &io_backend { IOBackend::NormalRead | IOBackend::PositionedRead => { - let mut index = OpenOptions::default() - .read(true) - .write(false) - .open(path_of_index_column) - .await?; - // TODO(chi): add an index cache later - let mut index_content = vec![]; - index.read_to_end(&mut index_content).await?; + let index_content = read(&path_of_index_column).await?; Bytes::from(index_content) } IOBackend::InMemory(map) => {