Skip to content

Commit

Permalink
Record number of regions evicted in SsdCacheStats (facebookincubator#…
Browse files Browse the repository at this point in the history
…9686)

Summary: Pull Request resolved: facebookincubator#9686

Reviewed By: xiaoxmeng

Differential Revision: D56837945

Pulled By: zacw7

fbshipit-source-id: 7ad13d46e34b9b9ae70f90b4243f155c75c7aa80
  • Loading branch information
zacw7 authored and facebook-github-bot committed May 1, 2024
1 parent 9650e30 commit 15780e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions velox/common/caching/SsdFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ bool SsdFile::growOrEvictLocked() {

logEviction(candidates);
clearRegionEntriesLocked(candidates);
stats_.regionsEvicted += candidates.size();
writableRegions_ = std::move(candidates);
suspended_ = false;
return true;
Expand Down Expand Up @@ -532,6 +533,7 @@ void SsdFile::updateStats(SsdCacheStats& stats) const {
}
stats.entriesAgedOut += stats_.entriesAgedOut;
stats.regionsAgedOut += stats_.regionsAgedOut;
stats.regionsEvicted += stats_.regionsEvicted;
for (auto pins : regionPins_) {
stats.numPins += pins;
}
Expand Down
2 changes: 2 additions & 0 deletions velox/common/caching/SsdFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ struct SsdCacheStats {
bytesCached = tsanAtomicValue(other.bytesCached);
entriesAgedOut = tsanAtomicValue(other.entriesAgedOut);
regionsAgedOut = tsanAtomicValue(other.regionsAgedOut);
regionsEvicted = tsanAtomicValue(other.regionsEvicted);
numPins = tsanAtomicValue(other.numPins);

openFileErrors = tsanAtomicValue(other.openFileErrors);
Expand All @@ -162,6 +163,7 @@ struct SsdCacheStats {
tsan_atomic<uint64_t> bytesCached{0};
tsan_atomic<uint64_t> entriesAgedOut{0};
tsan_atomic<uint64_t> regionsAgedOut{0};
tsan_atomic<uint64_t> regionsEvicted{0};
tsan_atomic<int32_t> numPins{0};

tsan_atomic<uint32_t> openFileErrors{0};
Expand Down

0 comments on commit 15780e0

Please sign in to comment.