[Enhancement] Use shared file reader when read a segment (#10896)

* readers under a segment use a shared FileReader

* no need to cache fd in LocalFileReader
This commit is contained in:
plat1ko
2022-07-17 07:54:58 +08:00
committed by GitHub
parent c45a98d4c0
commit eec142ae90
41 changed files with 215 additions and 248 deletions

View File

@ -378,8 +378,8 @@ private:
}
}
std::unique_ptr<io::FileWriter> creat_file_writer(const std::string& path) {
std::unique_ptr<io::FileWriter> file_writer;
io::FileWriterPtr creat_file_writer(const std::string& path) {
io::FileWriterPtr file_writer;
io::global_local_filesystem()->create_file(path, &file_writer);
return file_writer;
}
@ -409,8 +409,8 @@ private:
return st.ok() ? std::move(reader) : nullptr;
}
std::unique_ptr<io::FileReader> create_readable_block(const std::string& path) {
std::unique_ptr<io::FileReader> reader;
io::FileReaderSPtr create_readable_block(const std::string& path) {
io::FileReaderSPtr reader;
auto st = io::global_local_filesystem()->open_file(path, &reader);
return st.ok() ? std::move(reader) : nullptr;
}