[tarantool-patches] Re: [PATCH v2] xrow: print corrupted rows on decoding error.

Vladimir Davydov vdavydov.dev at gmail.com
Fri Apr 5 16:43:20 MSK 2019


On Fri, Apr 05, 2019 at 04:20:15PM +0300, Konstantin Osipov wrote:
> * 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__

You're right. Let's move print to a helper function then.

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

Makes sense.

Sergey, please prepare a follow-up patch to fix these issues.



More information about the Tarantool-patches mailing list