To properly implement the database snapshotting, the pending I/O operation need to be cancelled without terminating the ring itself as this is needed to carry out the I/O operations to generate the database snapshot.
This will require introducing an ad hoc flow in the events processing loop that, upon the termination request, will:
close all the pending connections
set a next run in the past
wait until the next run field changes before terminating
A new config flag has to be added to control this behaviour as the second and third step must be carried out only if a snapshot on shutdown is requested.
Potentially on more recent kernels it's possible to issue a cancellation request with the flag IORING_ASYNC_CANCEL_ANY
To properly implement the database snapshotting, the pending I/O operation need to be cancelled without terminating the ring itself as this is needed to carry out the I/O operations to generate the database snapshot.
This will require introducing an ad hoc flow in the events processing loop that, upon the termination request, will:
A new config flag has to be added to control this behaviour as the second and third step must be carried out only if a snapshot on shutdown is requested.
Potentially on more recent kernels it's possible to issue a cancellation request with the flag IORING_ASYNC_CANCEL_ANY
More info at https://man7.org/linux/man-pages/man3/io_uring_prep_cancel64.3.html