[tarantool-patches] [PATCH v2 1/2] tarantoolctl: fix cat and play for empty body requests

Konstantin Osipov kostja at tarantool.org
Wed Sep 26 01:31:34 MSK 2018


* Serge Petrenko <sergepetrenko at tarantool.org> [18/09/24 18:11]:
> If space.before_replace returns the old tuple, the operation turns into
> no-op, but is still written to WAL as IPROTO_NOP for the sake of
> replication. Such a request doesn't have a body, and tarantoolctl failed
> to parse such requests in `tarantoolctl cat` and `tarantoolctl play`.
> Fix this by checking whether a request has a body. Also skip such
> requests in `play`, since they have no effect, and, while we're at it,
> make sure `play` and `cat` do not read excess rows with lsn>=to in case
> these rows are skipped.
> 
> Closes #3675
> ---
>  extra/dist/tarantoolctl.in         | 32 ++++++++++++++++++------------
>  test/app-tap/tarantoolctl.test.lua | 14 ++++++++++---
>  2 files changed, 30 insertions(+), 16 deletions(-)
> 
> diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
> index 3d7ff3ec5..588ca1729 100755
> --- a/extra/dist/tarantoolctl.in
> +++ b/extra/dist/tarantoolctl.in
> @@ -373,6 +373,12 @@ write_lua_table = function(tuple)
>  end
>  
>  local function cat_lua_cb(record)
> +    -- Ignore both versions of IPROTO_NOP: the one without a
> +    -- body (new), and the one with empty body (old).
> +    if record.HEADER.type == 'NOP' or record.BODY == nil or
> +       record.BODY.space_id == nil then
> +        return
> +    end

This comment doesn't match the code. You ignore all records with
an empty body, not just NOP records. This is obviously incorrect.

> 

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov



More information about the Tarantool-patches mailing list