MCPcopy Create free account
hub / github.com/bytedance/bolt / appendSsdSaveable

Method appendSsdSaveable

bolt/common/caching/AsyncDataCache.cpp:566–587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564}
565
566void CacheShard::appendSsdSaveable(std::vector<CachePin>& pins) {
567 std::lock_guard<std::mutex> l(mutex_);
568 // Do not add more than 70% of entries to a write batch.If SSD save
569 // is slower than storage read, we must not have a situation where
570 // SSD save pins everything and stops reading.
571 const int32_t limit = (entries_.size() * 100) / 70;
572 BOLT_CHECK(cache_->ssdCache()->writeInProgress());
573 for (auto& entry : entries_) {
574 if (entry && !entry->ssdFile_ && !entry->isExclusive() &&
575 entry->ssdSaveable()) {
576 CachePin pin;
577 ++entry->numPins_;
578 pin.setEntry(entry.get());
579 pins.push_back(std::move(pin));
580 if (pins.size() >= limit) {
581 BOLT_SSD_CACHE_LOG(INFO)
582 << "Limiting SSD save batch to " << limit << " entries";
583 break;
584 }
585 }
586 }
587}
588
589bool CacheShard::removeFileEntries(
590 const folly::F14FastSet<uint64_t>& filesToRemove,

Callers 1

saveToSsdMethod · 0.80

Calls 8

writeInProgressMethod · 0.80
ssdCacheMethod · 0.80
isExclusiveMethod · 0.80
ssdSaveableMethod · 0.80
setEntryMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected