[Tarantool-patches] [PATCH v2 2/7] applier: extract tx boundary checks from applier_read_tx into a separate routine

Serge Petrenko sergepetrenko at tarantool.org
Sat Mar 27 19:54:52 MSK 2021



26.03.2021 15:35, Cyrill Gorcunov пишет:
> On Wed, Mar 24, 2021 at 03:24:12PM +0300, Serge Petrenko wrote:
>> Introduce a new routine, set_next_tx_row(), which checks tx boundary
>> violation and appends the new row to the current tx in case everything
>> is ok.
>>
>> set_next_tx_row() is extracted from applier_read_tx() because it's a
>> common part of transaction assembly both for recovery and applier.
>>
>> The only difference for recovery will be that the routine which's
>> responsible for tx assembly won't read rows. It'll be a callback ran on
>> each new row being read from WAL.
>>
>> Prerequisite #5874
>> Part-of #5566
>> ---
>>   src/box/applier.cc | 117 +++++++++++++++++++++++----------------------
>>   1 file changed, 60 insertions(+), 57 deletions(-)
>>
>> diff --git a/src/box/applier.cc b/src/box/applier.cc
>> index 326cf18d2..65afa5e98 100644
>> --- a/src/box/applier.cc
>> +++ b/src/box/applier.cc
>> @@ -657,6 +657,64 @@ applier_read_tx_row(struct applier *applier)
>>   	return tx_row;
>>   }
>>   
>> +static inline int64_t
>> +set_next_tx_row(struct stailq *rows, struct applier_tx_row *tx_row, int64_t tsn)
> Serge, why it is "inline"? I propose to not use inline until really needed.
> The compiler may ignore inline word, same time if function is small the
> compiler may inline it as a part of optimisation stage.
>
> Not a big deal, feel free to ignore, but I see "inline" is used too much all over the code :(
>
> https://www.kernel.org/doc/html/v4.10/process/coding-style.html#the-inline-disease

Thanks for the review!
No problem.

diff --git a/src/box/applier.cc b/src/box/applier.cc
index 65afa5e98..00869d480 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -657,7 +657,7 @@ applier_read_tx_row(struct applier *applier)
      return tx_row;
  }

-static inline int64_t
+static int64_t
  set_next_tx_row(struct stailq *rows, struct applier_tx_row *tx_row, 
int64_t tsn)
  {
      struct xrow_header *row = &tx_row->row;


-- 
Serge Petrenko



More information about the Tarantool-patches mailing list