mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 09:30:45 +00:00
" Currently, register_inactive_read accepts an eviction_notify_handler to be called when the inactive_read is evicted. However, in case there was an error in register_inactive_read the notification function isn't called leaving behind state that needs to be cleaned up. This series separates the register_inactive_reader interface into 2 parts: 1. register_inactive_reader(flat_mutation_reader) - which just registers the reader and return an inactive_read_handle, *if permitted*. Otherwise, the notification handler is not called (it is not known yet) and the caller is not expected to do anything fance at this point that will require cleanup. This optimizes the server when overloaded since we do less work that we'd need to undo in case the reader_concurrecy_semaphore runs out of resources. 2. After register_inactive_reader succeeded to return a valid inactive_read_handle, the caller sets up its local state and may call `set_notify_handler` to set the optional notify_handler and ttl on the o_r_h. After this state, the notify_handler will be called when the inactive_reader is evicted, for any reason. querier_cache::insert_querier was modified to use the above procedure and to handle (and log/ignore) any error in the process. inactive_read_handle and inactive_read keeping track of each other was simplified by keeping an iterator in the handle and a backpointer in the inactive_read object. The former is used to evict the reader and to set the notify_handler and/or ttl without having to lookup the i_r. The latter is used to invalidate the i_r_h when the i_r is destroyed. Test: unit(release), querier_cache_test(debug) " * tag 'register_inactive_read-error-handling-v6' of github.com:bhalevy/scylla: querier_cache: insert_querier: ignore errors to register inactive reader querier_cache: insert_querier: handle errors querier_utils: mark functions noexcept reader_concurrency_semaphore: register_inactive_read: make noexcept reader_concurrency_semaphore: separate set_notify_handler from register_inactive_reader reader_concurrency_semaphore: inactive_read: make ttl_timer non-optional reader_concurrency_semaphore: inactive_read: use intrusive list reader_concurrency_semaphore: do_wait_admission: use try_evict_one_inactive_read reader_concurrency_semaphore: try_evict_one_inactive_read: pass evict_reason reader_concurrency_semaphore: unregister_inactive_read: calling on wrong semaphore is an internal error reader_concurrency_semaphore: unregister_inactive_read: do nothing if disengaged reader_concurrency_semaphore: inactive_read_handle: swap definition order reader_lifecycle_policy: retire low level try_resume method reader_concurrency_semaphore: inactive_read: keep a flat_mutation_reader