Skip to content

Commit

Permalink
chore: replace read_to_end() (#801)
Browse files Browse the repository at this point in the history
Signed-off-by: xiaguan <[email protected]>
  • Loading branch information
xiaguan authored Oct 17, 2023
1 parent 58c42c5 commit 904e528
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/storage/secondary/rowset/disk_rowset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 904e528

Please sign in to comment.