From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 26 Sep 2018 01:31:34 +0300 From: Konstantin Osipov Subject: Re: [tarantool-patches] [PATCH v2 1/2] tarantoolctl: fix cat and play for empty body requests Message-ID: <20180925223134.GC3137@chai> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com, Serge Petrenko List-ID: * Serge Petrenko [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