[Tarantool-patches] [PATCH vshard 10/11] sched: introduce vshard.storage.sched module

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Mar 6 01:06:45 MSK 2021


Thanks for the review!

On 04.03.2021 22:02, Oleg Babin wrote:
> 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.

These are special cases covered with tests in unit-tap/scheduler.test.lua
in test_move_zero_quota() and test_ref_zero_quota().

Zero quota means the operation can be suppressed by the other operation
infinitely long.


More information about the Tarantool-patches mailing list