| 267 | } |
| 268 | |
| 269 | int |
| 270 | CacheVC::openWriteCloseDir(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) |
| 271 | { |
| 272 | cancel_trigger(); |
| 273 | { |
| 274 | CACHE_TRY_LOCK(lock, stripe->mutex, mutex->thread_holding); |
| 275 | if (!lock.is_locked()) { |
| 276 | SET_HANDLER(&CacheVC::openWriteCloseDir); |
| 277 | ink_assert(!is_io_in_progress()); |
| 278 | VC_SCHED_LOCK_RETRY(); |
| 279 | } |
| 280 | stripe->close_write(this); |
| 281 | if (closed < 0 && fragment) { |
| 282 | dir_delete(&earliest_key, stripe, &earliest_dir); |
| 283 | } |
| 284 | } |
| 285 | if (dbg_ctl_cache_update.on()) { |
| 286 | if (f.update && closed > 0) { |
| 287 | if (!total_len && !f.allow_empty_doc && alternate_index != CACHE_ALT_REMOVED) { |
| 288 | Dbg(dbg_ctl_cache_update, "header only %d (%" PRIu64 ", %" PRIu64 ")", DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0], |
| 289 | update_key.b[1]); |
| 290 | |
| 291 | } else if ((total_len || f.allow_empty_doc) && alternate_index != CACHE_ALT_REMOVED) { |
| 292 | Dbg(dbg_ctl_cache_update, "header body, %d, (%" PRIu64 ", %" PRIu64 "), (%" PRIu64 ", %" PRIu64 ")", |
| 293 | DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0], update_key.b[1], earliest_key.b[0], earliest_key.b[1]); |
| 294 | } else if (!total_len && alternate_index == CACHE_ALT_REMOVED) { |
| 295 | Dbg(dbg_ctl_cache_update, "alt delete, %d, (%" PRIu64 ", %" PRIu64 ")", DIR_MASK_TAG(first_key.slice32(2)), update_key.b[0], |
| 296 | update_key.b[1]); |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | // update the appropriate stat variable |
| 301 | // These variables may not give the current no of documents with |
| 302 | // one, two and three or more fragments. This is because for |
| 303 | // updates we dont decrement the variable corresponding the old |
| 304 | // size of the document |
| 305 | if ((closed == 1) && (total_len > 0 || f.allow_empty_doc)) { |
| 306 | DDbg(dbg_ctl_cache_stats, "Fragment = %d", fragment); |
| 307 | |
| 308 | ts::Metrics::Counter::increment(cache_rsb.fragment_document_count[std::clamp(fragment, 0, 2)]); |
| 309 | ts::Metrics::Counter::increment(stripe->cache_vol->vol_rsb.fragment_document_count[std::clamp(fragment, 0, 2)]); |
| 310 | } |
| 311 | if (f.close_complete) { |
| 312 | recursive++; |
| 313 | ink_assert(!stripe || this_ethread() != stripe->mutex->thread_holding); |
| 314 | vio.cont->handleEvent(VC_EVENT_WRITE_COMPLETE, reinterpret_cast<void *>(&vio)); |
| 315 | recursive--; |
| 316 | } |
| 317 | return free_CacheVC(this); |
| 318 | } |
| 319 | |
| 320 | int |
| 321 | CacheVC::openWriteCloseHeadDone(int event, Event *e) |
no test coverage detected