| 564 | } |
| 565 | |
| 566 | void 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 | |
| 589 | bool CacheShard::removeFileEntries( |
| 590 | const folly::F14FastSet<uint64_t>& filesToRemove, |
no test coverage detected