[tarantool-patches] Re: [PATCH v2] xrow: print corrupted rows on decoding error.
Konstantin Osipov
kostja at tarantool.org
Fri Apr 5 16:20:15 MSK 2019
* Vladimir Davydov <vdavydov.dev at 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
More information about the Tarantool-patches
mailing list