Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ bool DorisCompoundDirectory::FSIndexInput::open(const io::FileSystemSPtr& fs, co
}
auto* h = _CLNEW SharedHandle(path);

if (!fs->open_file(path, &h->_reader).ok()) {
io::FileDescription fd;
fd.path = path;
io::FileBlockCachePathPolicy cache_policy;
auto type = config::enable_file_cache ? config::file_cache_type : "";
io::FileReaderOptions reader_options(io::cache_type_from_string(type), cache_policy);
if (!fs->open_file(fd, reader_options, &h->_reader).ok()) {
error.set(CL_ERR_IO, "open file error");
}

Expand Down Expand Up @@ -295,6 +300,7 @@ DorisCompoundDirectory::FSIndexInput::FSIndexInput(const FSIndexInput& other)
std::lock_guard<std::mutex> wlock(*other._handle->_shared_lock);
_handle = _CL_POINTER(other._handle);
_pos = other._handle->_fpos; //note where we are currently...
_io_ctx = other._io_ctx;
}

DorisCompoundDirectory::FSIndexInput::SharedHandle::SharedHandle(const char* path) {
Expand Down Expand Up @@ -361,7 +367,7 @@ void DorisCompoundDirectory::FSIndexInput::readInternal(uint8_t* b, const int32_

Slice result {b, (size_t)len};
size_t bytes_read = 0;
if (!_handle->_reader->read_at(_pos, result, &bytes_read).ok()) {
if (!_handle->_reader->read_at(_pos, result, &bytes_read, &_io_ctx).ok()) {
_CLTHROWA(CL_ERR_IO, "read past EOF");
}
bufferLength = len;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ class DorisCompoundDirectory::FSIndexInput : public lucene::store::BufferedIndex

SharedHandle* _handle = nullptr;
int64_t _pos;
io::IOContext _io_ctx;

FSIndexInput(SharedHandle* handle, int32_t buffer_size) : BufferedIndexInput(buffer_size) {
this->_pos = 0;
this->_handle = handle;
this->_io_ctx.reader_type = ReaderType::READER_QUERY;
}

protected:
Expand Down