[Tarantool-patches] [PATCH vshard 01/11] error: introduce vshard.error.timeout()

Oleg Babin olegrok at tarantool.org
Thu Feb 25 15:42:13 MSK 2021


Thanks for your answers, consider my comments below.


On 25.02.2021 00:46, Vladislav Shpilevoy wrote:
> Hi! Thanks for the review!
>
> On 24.02.2021 11:27, Oleg Babin wrote:
>> Hi! Thanks for your patch.
>>
>> Personally, I vote for dropping 1.9 support (it's already broken - #256).
> It kind of works. Just with some spam in the logs. But yeah, I would like
> to finally drop it. I talked to Mons and he approved this:
> https://github.com/tarantool/vshard/issues/267

Good news!

>> But if you want to eliminate "long and ugly" ways you could do something like:
>>
>>
>> ```
>>
>> local make_timeout
>> if box.error.new ~= nil then
>>      make_timeout = function() return box.error.new(box.error.TIMEOUT) end
>> else
>>      make_timeout = function() return select(2, pcall(...)) end
>> end
>>
>> ```
> Which is longer and uglier, right? Where is the win?

Not sure it's important for errors but pcall is a bit slower.


```

local clock = require('clock')

local start = clock.time()
for _ = 1,1e5 do
     pcall(box.error, box.error.TIMEOUT)
end
print(clock.time() - start)

local start = clock.time()
for _ = 1,1e5 do
     box.error.new(box.error.TIMEOUT)
end
print(clock.time() - start)

```

0.22471904754639
0.12087297439575

(on my Mac)


Feel free to ignore. LGTM.



More information about the Tarantool-patches mailing list