[Tarantool-patches] [PATCH v4 5/6] box/func: implement cfunc Lua module

Cyrill Gorcunov gorcunov at gmail.com
Tue Oct 6 15:55:29 MSK 2020


On Mon, Oct 05, 2020 at 11:59:05PM +0200, Vladislav Shpilevoy wrote:
...
> 
> I just stated a fact - whatever you post after "TarantoolBot document" goes to
> a github issue as is, unedited. Therefore it will be interpreted as github
> markdown, unconditionally. So you need to write things to make them readable
> in github. If you use sphinx markdown, it won't be displayed as sphinx markdown
> anyway. It will be displayed in github markdown.
> 
> Talking of the idea about writing docs for copy-pasting, I don't think it can be
> done with the current flow of documentation updates. Doc team anyway needs to
> find a place to put your text into, translate it to Russian, review and correct
> your markdown. Also if we need to write in sphinx style, it means we need to
> patch docbot to somehow turn github markdown off, and make other team members
> learn this markdown - how to write it and validate. With all that said - why
> do we even need a whole documentation team, if this is basically all they do?
> 
> I would better let us write more free-style documentation requests, and let the
> doc team do their job.

OK

> >>
> >> 12. You allocated 'sizeof(*cfunc) + name_len + 1)', not only sizeof.
> > 
> > I know, the name of the function is placed right after the structure.
> > It is intended.
> 
> How is it related? diag_set in the second argument takes allocation
> size. You tried to allocate sizeof(*cfunc) + name_len + 1, but
> reported sizeof(*cfunc), which is smaller. It does not depend on what
> you allocate. Only how much.

Wait, I got it -- you meant the diag_set report. Sorry misundertood you
in first place. Thanks, will fix.

> >>> +	struct cfunc *cfunc = cfunc_lookup(name, name_len);
> >>> +	if (cfunc == NULL) {
> >>> +		const char *fmt = tnt_errcode_desc(ER_NO_SUCH_FUNCTION);
> >>> +		diag_set(IllegalParams, fmt, name);
> >>> +		return luaT_error(L);
> >>> +	}
> >>> +
> >>> +	lua_State *args_L = luaT_newthread(tarantool_L);
> >>
> >> 18. Wtf? Why can't you use L? Why do you even move anything here
> >> between the stacks?
> > 
> > Well, actually it comes from lbox_func_call, I couldn't extract this
> > into a separate helper. To be honest I do not really undertand why
> > luaT_newthread is used in lbox_func_call but I presume this is the
> > template of calling external functions in Lua?
> 
> We don't copy code presuming that it does something. Lets better
> understand why is it needed instead of blindly copying it.
> Currently I don't see any reason why is it needed.
> 
> Tbh I don't know why is it needed in lbox_func_call() either. The
> comment there is super unclear about that. It just says what is
> done, and not why.

I presume it is because of coio thread, will take more precise look
once I manage with general api.


More information about the Tarantool-patches mailing list