[Tarantool-patches] [PATCH vshard 10/11] sched: introduce vshard.storage.sched module
Oleg Babin
olegrok at tarantool.org
Fri Mar 5 00:02:10 MSK 2021
Hi! I've looked your patch again. See one comment below.
On 23.02.2021 03:15, Vladislav Shpilevoy wrote:
> +--
> +-- Return the remaining timeout in case there was a yield. This helps to save
> +-- current clock get in the caller code if there were no yields.
> +--
> +local function sched_ref_start(timeout)
> + local deadline = fiber_clock() + timeout
> + local ok, err
> + -- Fast-path. Moves are extremely rare. No need to inc-dec the ref queue
> + -- then nor try to start some loops.
> + if M.move_count == 0 and M.move_queue == 0 then
> + goto success
> + end
> +
> + M.ref_queue = M.ref_queue + 1
> +
> +::retry::
> + if M.move_count > 0 then
> + goto wait_and_retry
> + end
> + -- Even if move count is zero, must ensure the time usage is fair. Does not
> + -- matter in case the moves have no quota at all. That allows to ignore them
> + -- infinitely until all refs end voluntarily.
> + if M.move_queue > 0 and M.ref_strike >= M.ref_quota and
> + M.move_quota > 0 then
Is it reasonable to check `move_quota > 0`. According tests it always
should be positive.
I see similar check for `ref_quota` as well.
More information about the Tarantool-patches
mailing list