Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
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 16:20:15 +0300	[thread overview]
Message-ID: <20190405132015.GA1687@chai> (raw)
In-Reply-To: <20190405080608.uyuunti2tebak5wl@esperanza>

* Vladimir Davydov <vdavydov.dev@gmail.com> [19/04/05 16:11]:
> > But provided you had to write your own implementation:
> > - why use a macro?
> 
> So that diag_set() and say() preserve file/line.

You inline the  macro multiple times. This makes the function body
longer -> CPU job more difficult. You could easily pass file and
line into the function, these are ansi c standard macros, __FILE__
and __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.

It's 1024 bytes.
What's the point of printing it as a single say() call, not as
multiple ones? 

Besides, there is a 4k buffer inside say which limits you anwyay.

> > - 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.


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

  reply	other threads:[~2019-04-05 13:20 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
2019-04-05 13:20               ` Konstantin Osipov [this message]
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=20190405132015.GA1687@chai \
    --to=kostja@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --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