MCPcopy Create free account
hub / github.com/apache/trafficserver / openReadReadDone

Method openReadReadDone

src/iocore/cache/CacheRead.cc:443–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443int
444CacheVC::openReadReadDone(int event, Event *e)
445{
446 Doc *doc = nullptr;
447
448 cancel_trigger();
449 if (event == EVENT_IMMEDIATE) {
450 return EVENT_CONT;
451 }
452 set_io_not_in_progress();
453 {
454 CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding);
455 if (!lock.is_locked()) {
456 VC_SCHED_LOCK_RETRY();
457 }
458 if (event == AIO_EVENT_DONE && !io.ok()) {
459 goto Lerror;
460 }
461 if (last_collision && // no missed lock
462 stripe->dir_valid(&dir)) // object still valid
463 {
464 doc = reinterpret_cast<Doc *>(buf->data());
465 if (doc->magic != DOC_MAGIC) {
466 char tmpstring[CRYPTO_HEX_SIZE];
467 if (doc->magic == DOC_CORRUPT) {
468 Warning("Middle: Doc checksum does not match for %s", key.toHexStr(tmpstring));
469 } else {
470 Warning("Middle: Doc magic does not match for %s", key.toHexStr(tmpstring));
471 }
472 goto Lerror;
473 }
474 if (doc->key == key) {
475 goto LreadMain;
476 }
477 }
478 if (last_collision && dir_offset(&dir) != dir_offset(last_collision)) {
479 last_collision = nullptr; // object has been/is being overwritten
480 }
481 if (dir_probe(&key, stripe, &dir, &last_collision)) {
482 int ret = do_read_call(&key);
483 if (ret == EVENT_RETURN) {
484 goto Lcallreturn;
485 }
486 return EVENT_CONT;
487 } else if (write_vc) {
488 if (writer_done()) {
489 last_collision = nullptr;
490 while (dir_probe(&earliest_key, stripe, &dir, &last_collision)) {
491 if (dir_offset(&dir) == dir_offset(&earliest_dir)) {
492 DDbg(dbg_ctl_cache_read_agg, "%p: key: %X ReadRead complete: %" PRId64, this, first_key.slice32(1), vio.ndone);
493 doc_len = vio.ndone;
494 goto Ldone;
495 }
496 }
497 DDbg(dbg_ctl_cache_read_agg, "%p: key: %X ReadRead writer aborted: %" PRId64, this, first_key.slice32(1), vio.ndone);
498 goto Lerror;
499 }
500 if (writer_lock_retry < cache_config_read_while_writer_max_retries) {

Callers

nothing calls this directly

Calls 11

dir_probeFunction · 0.85
dir_deleteFunction · 0.85
next_CacheKeyFunction · 0.85
toHexStrMethod · 0.80
string_get_refMethod · 0.80
url_getMethod · 0.80
okMethod · 0.45
dir_validMethod · 0.45
dataMethod · 0.45
validMethod · 0.45
prefix_lenMethod · 0.45

Tested by

no test coverage detected