MCPcopy Create free account
hub / github.com/apache/impala / StoreInternal

Method StoreInternal

be/src/runtime/io/data-cache.cc:1488–1508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1486}
1487
1488bool DataCache::StoreInternal(const CacheKey& key, const uint8_t* buffer,
1489 int64_t buffer_len) {
1490 // Here, a shared lock is acquired with try_to_lock, while a unique lock is acquired in
1491 // SetDataCacheReadOnly(). Therefore, when setting the read-only status, the lock
1492 // acquisition here can quickly fail, then return.
1493 kudu::shared_lock<shared_mutex> lock(readonly_lock_, std::try_to_lock);
1494 if (UNLIKELY(!lock.owns_lock() || readonly_.Load())) return false;
1495
1496 int idx = key.Hash() % partitions_.size();
1497 bool start_reclaim;
1498 bool stored = partitions_[idx]->Store(key, buffer, buffer_len, &start_reclaim);
1499 if (VLOG_IS_ON(3)) {
1500 stringstream ss;
1501 ss << std::hex << reinterpret_cast<int64_t>(buffer);
1502 LOG(INFO) << Substitute("Storing $0 mtime: $1 offset: $2 bytes_to_read: $3 "
1503 "buffer: 0x$4 stored: $5", key.filename().ToString(), key.mtime(), key.offset(),
1504 buffer_len, ss.str(), stored);
1505 }
1506 if (start_reclaim) file_deleter_pool_->Offer(idx);
1507 return stored;
1508}
1509
1510void DataCache::Partition::Trace(
1511 const trace::EventType& type, const DataCache::CacheKey& key,

Callers

nothing calls this directly

Calls 12

SubstituteFunction · 0.85
owns_lockMethod · 0.80
OfferMethod · 0.80
LoadMethod · 0.45
HashMethod · 0.45
sizeMethod · 0.45
StoreMethod · 0.45
ToStringMethod · 0.45
filenameMethod · 0.45
mtimeMethod · 0.45
offsetMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected