| 1151 | } |
| 1152 | |
| 1153 | io::DiskFile* TmpFileRemote::GetReadBufferFile(int64_t offset) { |
| 1154 | // If the local buffer file exists, return the file directly. |
| 1155 | // If it is deleted (probably due to eviction), and batch reading is enabled, would |
| 1156 | // try to fetch the current block asynchronously if it is not present in the memory |
| 1157 | // buffer. |
| 1158 | // If the local buffer file is deleted and the read memory buffer doesn't have the |
| 1159 | // block right now, then return a nullptr to indicate there is no buffer available. |
| 1160 | io::DiskFile* read_buffer_file = disk_buffer_file_.get(); |
| 1161 | if (disk_buffer_file_->GetFileStatus() != io::DiskFileStatus::DELETED) { |
| 1162 | return read_buffer_file; |
| 1163 | } |
| 1164 | if (!file_group_->tmp_file_mgr()->IsRemoteBatchReadingEnabled()) return nullptr; |
| 1165 | int read_buffer_idx = GetReadBufferIndex(offset); |
| 1166 | io::MemBlock* read_buffer_block = disk_buffer_file_->GetBufferBlock(read_buffer_idx); |
| 1167 | bool fetched = false; |
| 1168 | io::MemBlockStatus block_status = read_buffer_block->GetStatus(); |
| 1169 | if (block_status == io::MemBlockStatus::DISABLED) { |
| 1170 | // do nothing |
| 1171 | } else if (block_status == io::MemBlockStatus::WRITTEN) { |
| 1172 | fetched = true; |
| 1173 | } else { |
| 1174 | AsyncFetchReadBufferBlock( |
| 1175 | read_buffer_file, read_buffer_block, read_buffer_idx, &fetched); |
| 1176 | } |
| 1177 | return fetched ? read_buffer_file : nullptr; |
| 1178 | } |
| 1179 | |
| 1180 | bool TmpFileRemote::IncrementReadPageCount(int buffer_idx) { |
| 1181 | int64_t read_count = 0; |
no test coverage detected