[Tarantool-patches] [PATCH] relay: yield explicitly every N sent rows

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Wed Feb 24 01:30:47 MSK 2021


Thanks for the patch!

>>> diff --git a/src/box/relay.cc b/src/box/relay.cc
>>> index 1d8edf116..6d9269e1d 100644
>>> --- a/src/box/relay.cc
>>> +++ b/src/box/relay.cc
>>> @@ -117,6 +117,11 @@ struct relay {
>>>           * is passed by the replica on subscribe.
>>>           */
>>>          uint32_t id_filter;
>>> +       /**
>>> +        * How many rows has this relay sent to the replica. Used to yield once
>>> +        * in a while when reading a WAL to unblock the event loop.
>>> +        */
>>> +       size_t row_cnt;

Name is a bit ugly, because all the other members are not
contractions. They use full words. But up to you.

>> 1. But it is not a size of anything, right? Maybe make it
>> int64_t then?
> 
> uint64_t, probably?

Nope, int64_t. It is supposed to be 'faster'. Because it does
not have defined overflow rules, and therefore the hardware does
not need to handle it.

But honestly, I didn't measure. For me it is more cargo cult. I
just use signed integers where I can assuming that the hardware
really may omit an instruction or so.

Up to you.

The patch about power of 2 worked btw. This is how it looks now:

	andq   $0x7fff, %rcx             ; imm = 0x7FFF

this is how it used to look:

	movl   $0x7d00, %ecx             ; imm = 0x7D00 
	divq   %rcx


More information about the Tarantool-patches mailing list