| 573 | } |
| 574 | |
| 575 | void TupleCacheMgr::EvictedEntry(Slice key, Slice value) { |
| 576 | const TupleCacheEntry* entry = reinterpret_cast<const TupleCacheEntry*>(value.data()); |
| 577 | if (TupleCacheState::TOMBSTONE != entry->state) { |
| 578 | DCHECK(tuple_cache_entries_evicted_ != nullptr); |
| 579 | DCHECK(tuple_cache_entries_in_use_ != nullptr); |
| 580 | DCHECK(tuple_cache_entries_in_use_bytes_ != nullptr); |
| 581 | tuple_cache_entries_evicted_->Increment(1); |
| 582 | tuple_cache_entries_in_use_->Increment(-1); |
| 583 | DCHECK_GE(tuple_cache_entries_in_use_->GetValue(), 0); |
| 584 | // entries_in_use_bytes is incremented only when the entry reaches the |
| 585 | // COMPLETE_UNSYNCED state |
| 586 | if (TupleCacheState::COMPLETE_UNSYNCED == entry->state || |
| 587 | TupleCacheState::COMPLETE == entry->state) { |
| 588 | tuple_cache_entries_in_use_bytes_->Increment(-entry->charge); |
| 589 | DCHECK_GE(tuple_cache_entries_in_use_bytes_->GetValue(), 0); |
| 590 | } |
| 591 | // Outstanding write bytes are accumulated during IN_PROGRESS, and remain set until |
| 592 | // the transition from COMPLETE_UNSYNCED to COMPLETE. |
| 593 | if (TupleCacheState::COMPLETE_UNSYNCED == entry->state || |
| 594 | TupleCacheState::IN_PROGRESS == entry->state) { |
| 595 | DCHECK(tuple_cache_outstanding_writes_bytes_ != nullptr); |
| 596 | DCHECK_GE(tuple_cache_outstanding_writes_bytes_->GetValue(), entry->charge); |
| 597 | tuple_cache_outstanding_writes_bytes_->Increment(-entry->charge); |
| 598 | } |
| 599 | } else { |
| 600 | DCHECK(tuple_cache_tombstones_in_use_ != nullptr); |
| 601 | tuple_cache_tombstones_in_use_->Increment(-1); |
| 602 | DCHECK_GE(tuple_cache_tombstones_in_use_->GetValue(), 0); |
| 603 | } |
| 604 | // Retrieve the path following TupleCacheEntry. |
| 605 | value.remove_prefix(sizeof(TupleCacheEntry)); |
| 606 | value.truncate(value.size() - 1); |
| 607 | VLOG_FILE << "Tuple Cache: Evict " << key << " at " << value.ToString(); |
| 608 | // Delete file on disk. |
| 609 | kudu::Status status = kudu::Env::Default()->DeleteFile(value.ToString()); |
| 610 | if (!status.ok()) { |
| 611 | LOG(WARNING) << |
| 612 | Substitute("Failed to unlink $0: $1", value.ToString(), status.ToString()); |
| 613 | } |
| 614 | // If correctness checking is enabled, remove the associated metadata as well. |
| 615 | if (DebugDumpEnabled()) { |
| 616 | string key_str(reinterpret_cast<const char*>(key.data()), key.size()); |
| 617 | RemoveMetadataForTupleCache(key_str); |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | Status TupleCacheMgr::DeleteExistingFiles() const { |
| 622 | vector<string> entries; |
nothing calls this directly
no test coverage detected