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

Method ReplayEntry

be/src/runtime/io/data-cache-trace.cc:330–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330void TraceReplayer::ReplayEntry(const TraceEvent& entry) {
331 // First, update hit/miss counts as reported by the trace itself.
332 UpdateTraceStats(entry);
333
334 // Second, do the actual replay against the current cache (which may have different
335 // settings from the original cache). This mirrors the behavior of DiskIoMgr.
336 // Replay only needs hits and misses.
337 if (entry.type != EventType::HIT && entry.type != EventType::MISS) {
338 return;
339 }
340 DCHECK_GT(entry.lookup_length, 0);
341 // Try to read the whole chunk from the cache. If it does a partial read,
342 // the rest is a miss, but it will try to store the complete read into the cache.
343 int64_t bytes_read = data_cache_->Lookup(entry.filename, entry.mtime, entry.offset,
344 entry.lookup_length, /* buffer */ nullptr);
345 DCHECK_LE(bytes_read, entry.lookup_length);
346 if (bytes_read == 0) {
347 // Complete miss, and we try to store the whole chunk into the cache
348 ++replay_stats_.misses;
349 replay_stats_.miss_bytes += entry.lookup_length;
350 bool success = data_cache_->Store(entry.filename, entry.mtime, entry.offset,
351 /* buffer */ nullptr, entry.lookup_length);
352 if (success) {
353 ++replay_stats_.stores;
354 } else {
355 ++replay_stats_.failed_stores;
356 }
357 } else if (bytes_read == entry.lookup_length) {
358 // Total hit, nothing to store to the cache
359 ++replay_stats_.hits;
360 replay_stats_.hit_bytes += bytes_read;
361 } else {
362 // Partial hit, store complete entry to the cache
363 ++replay_stats_.partial_hits;
364 replay_stats_.hit_bytes += bytes_read;
365 replay_stats_.miss_bytes += entry.lookup_length - bytes_read;
366 bool success = data_cache_->Store(entry.filename, entry.mtime, entry.offset,
367 /* buffer */ nullptr, entry.lookup_length);
368 if (success) {
369 ++replay_stats_.stores;
370 } else {
371 ++replay_stats_.failed_stores;
372 }
373 }
374}
375} // namespace trace
376} // namespace io
377} // namespace impala

Callers

nothing calls this directly

Calls 2

LookupMethod · 0.45
StoreMethod · 0.45

Tested by

no test coverage detected