| 1772 | } |
| 1773 | |
| 1774 | Status TmpFileGroup::RestoreData(unique_ptr<TmpWriteHandle> handle, MemRange buffer, |
| 1775 | const BufferPoolClientCounters* counters) { |
| 1776 | DCHECK_EQ(handle->data_len(), buffer.len()); |
| 1777 | if (!handle->is_compressed()) DCHECK_EQ(handle->write_range_->data(), buffer.data()); |
| 1778 | DCHECK(!handle->write_in_flight_); |
| 1779 | DCHECK(handle->read_range_ == nullptr); |
| 1780 | |
| 1781 | VLOG(3) << "Restore " << handle->TmpFilePath() << " " << handle->write_range_->offset() |
| 1782 | << " " << handle->data_len(); |
| 1783 | Status status; |
| 1784 | if (handle->is_compressed()) { |
| 1785 | // 'buffer' already contains the data needed, because the compressed data was written |
| 1786 | // to 'compressed_' and (optionally) encrypted over there. |
| 1787 | } else if (FLAGS_disk_spill_encryption) { |
| 1788 | // Decrypt after the write is finished, so that we don't accidentally write decrypted |
| 1789 | // data to disk. |
| 1790 | status = handle->CheckHashAndDecrypt(buffer, counters); |
| 1791 | } |
| 1792 | RecycleFileRange(move(handle)); |
| 1793 | return status; |
| 1794 | } |
| 1795 | |
| 1796 | void TmpFileGroup::DestroyWriteHandle(unique_ptr<TmpWriteHandle> handle) { |
| 1797 | handle->Cancel(); |