Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org,
	Serge Petrenko <sergepetrenko@tarantool.org>,
	Kirill Yukhin <kyukhin@tarantool.org>
Subject: Re: [tarantool-patches] Re: [PATCH v2] xrow: print corrupted rows on decoding error.
Date: Fri, 5 Apr 2019 11:06:08 +0300	[thread overview]
Message-ID: <20190405080608.uyuunti2tebak5wl@esperanza> (raw)
In-Reply-To: <20190405061846.GA24274@chai>

On Fri, Apr 05, 2019 at 09:18:46AM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [19/04/04 17:57]:
> > Pushed to master, 2.1, 1.10.
> 
> This was fast.

The first version of this patch was submitted for review more than two
weeks ago, on March 15. We haven't heard from you since then. Though you
didn't care.

> 
> First of all, we already have request_str() function, and there is
> a good deal of code reuse that can take place.

request_str() prints a well-formed request. Here we want to dump
corrupted msgpack.

> 
> This comment, basically, says it all.
> 
> But provided you had to write your own implementation:
> - why use a macro?

So that diag_set() and say() preserve file/line.

> - why use malloc?

Because a corrupted request can easily be longer than 256 bytes (that's
how many bytes fits in tt_static_buf). Since it's a slow path, which is
only executed on decode error provided S_VERBOSE log level is enabled,
I reckon using malloc() is fine.

> - what's wrong with mp_snprint, and if the problem is that it
>   doesn't properly escape non-printable characters, why not fix it
>   to escape these or implement a version which does?

Because data can be corrupted, e.g. an MP_ARRAY with N items in the
header having only M < N items in the body. We can't print such data
with mp_snprint.

  reply	other threads:[~2019-04-05  8:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 13:09 Serge Petrenko
2019-04-03  9:18 ` Vladimir Davydov
2019-04-03  9:41   ` [tarantool-patches] " Kirill Yukhin
2019-04-04 11:52   ` Serge Petrenko
2019-04-04 12:06     ` Vladimir Davydov
2019-04-04 12:29       ` Serge Petrenko
2019-04-04 14:51         ` Vladimir Davydov
2019-04-05  6:18           ` Konstantin Osipov
2019-04-05  8:06             ` Vladimir Davydov [this message]
2019-04-05 13:20               ` Konstantin Osipov
2019-04-05 13:43                 ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190405080608.uyuunti2tebak5wl@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] Re: [PATCH v2] xrow: print corrupted rows on decoding error.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox