| 1192 | |
| 1193 | template <typename T> |
| 1194 | void TmpFileRemote::TryDeleteReadBuffer(const T& lock, int buffer_idx) { |
| 1195 | DCheckReadBufferIdx(buffer_idx); |
| 1196 | bool reserved = false; |
| 1197 | bool allocated = false; |
| 1198 | DCHECK(disk_buffer_file_->IsBatchReadEnabled()); |
| 1199 | DCHECK(lock.mutex() == disk_buffer_file_->GetFileLock() && lock.owns_lock()); |
| 1200 | disk_buffer_file_->DeleteReadBuffer( |
| 1201 | disk_buffer_file_->GetBufferBlock(buffer_idx), &reserved, &allocated, lock); |
| 1202 | if (reserved || allocated) { |
| 1203 | // Because the reservation will increase the current allocated read buffer usage |
| 1204 | // ahead of the real allocation, we need to decrease it if the block is reserved |
| 1205 | // or allocated. |
| 1206 | file_group_->tmp_file_mgr_->scratch_read_memory_buffer_used_metric_->Increment( |
| 1207 | -1 * read_buffer_block_size_); |
| 1208 | } |
| 1209 | } |
| 1210 | |
| 1211 | TmpDir* TmpFileRemote::GetLocalBufferDir() const { |
| 1212 | return file_group_->tmp_file_mgr_->GetLocalBufferDir(); |
no test coverage detected