create the directory entry after the vector has been evacuated the volume lock has been taken when this function is called
| 916 | // create the directory entry after the vector has been evacuated |
| 917 | // the volume lock has been taken when this function is called |
| 918 | int |
| 919 | CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) |
| 920 | { |
| 921 | cancel_trigger(); |
| 922 | set_io_not_in_progress(); |
| 923 | ink_assert(od); |
| 924 | od->writing_vec = false; |
| 925 | if (_action.cancelled) { |
| 926 | return openWriteCloseDir(EVENT_IMMEDIATE, nullptr); |
| 927 | } |
| 928 | { |
| 929 | CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); |
| 930 | if (!lock.is_locked()) { |
| 931 | VC_SCHED_LOCK_RETRY(); |
| 932 | } |
| 933 | if (io.ok()) { |
| 934 | ink_assert(f.evac_vector); |
| 935 | ink_assert(frag_type == CACHE_FRAG_TYPE_HTTP); |
| 936 | ink_assert(!buf); |
| 937 | f.evac_vector = false; |
| 938 | last_collision = nullptr; |
| 939 | f.update = 0; |
| 940 | alternate_index = CACHE_ALT_INDEX_DEFAULT; |
| 941 | f.use_first_key = 0; |
| 942 | vio.op = VIO::READ; |
| 943 | dir_overwrite(&first_key, stripe, &dir, &od->first_dir); |
| 944 | if (od->move_resident_alt) { |
| 945 | dir_insert(&od->single_doc_key, stripe, &od->single_doc_dir); |
| 946 | } |
| 947 | int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, params); |
| 948 | stripe->close_write(this); |
| 949 | if (alt_ndx >= 0) { |
| 950 | vector.clear(); |
| 951 | // we don't need to start all over again, since we already |
| 952 | // have the vector in memory. But this is simpler and this |
| 953 | // case is rare. |
| 954 | goto Lrestart; |
| 955 | } |
| 956 | } else { |
| 957 | stripe->close_write(this); |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | ts::Metrics::Counter::increment(cache_rsb.status[static_cast<int>(CacheOpType::Read)].failure); |
| 962 | ts::Metrics::Counter::increment(stripe->cache_vol->vol_rsb.status[static_cast<int>(CacheOpType::Read)].failure); |
| 963 | _action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, reinterpret_cast<void *>(-ECACHE_ALT_MISS)); |
| 964 | return free_CacheVC(this); |
| 965 | Lrestart: |
| 966 | SET_HANDLER(&CacheVC::openReadStartHead); |
| 967 | return openReadStartHead(EVENT_IMMEDIATE, nullptr); |
| 968 | } |
| 969 | |
| 970 | /* |
| 971 | This code follows CacheVC::openReadStartEarliest closely, |
nothing calls this directly
no test coverage detected