| 568 | } |
| 569 | |
| 570 | void BufferPool::Client::UndoMoveEvictedToPinned(Page* page) { |
| 571 | // We need to get the page back to the evicted state where: |
| 572 | // * There is no in-flight read. |
| 573 | // * The page's data is on disk referenced by 'write_handle' |
| 574 | // * The page has no attached buffer. |
| 575 | DCHECK(page->pin_in_flight.Load()); |
| 576 | page->write_handle->CancelRead(); |
| 577 | page->pin_in_flight.Store(false); |
| 578 | |
| 579 | unique_lock<mutex> lock(lock_); |
| 580 | DCHECK_CONSISTENCY(); |
| 581 | DCHECK(pinned_pages_.Contains(page)); |
| 582 | pinned_pages_.Remove(page); |
| 583 | // Discard the buffer - the pin was in flight so there was no way that a valid |
| 584 | // reference to the buffer's contents was returned since the pin was still in flight. |
| 585 | pool_->allocator_->Free(move(page->buffer)); |
| 586 | } |
| 587 | |
| 588 | Status BufferPool::Client::FinishMoveEvictedToPinned(Page* page) { |
| 589 | SCOPED_TIMER(counters().read_wait_time); |