[Tarantool-patches] [PATCH v4 2/2] box: introduce _vsession_settings sysview

Mergen Imeev imeevma at tarantool.org
Wed Nov 27 15:12:30 MSK 2019


On Wed, Nov 27, 2019 at 02:37:41PM +0300, Konstantin Osipov wrote:
> * Mergen Imeev <imeevma at tarantool.org> [19/11/27 14:22]:
> > > Where do you get the value from to build the tuple?
> > > 
> > I get it from current_session()->sql_flags and
> > current_session()->sql_default_engine.
> 
> OK, so my point is that they were put there as a historical
> artefact of sqlite conversion. It seemed then as the most logical
> place to put them. PRAGMAs were internal, so it was not a big
> deal.
> 
> But going forward it's a dangerous place to store them, they should be
> global - it fattens the session object, and if there are more
> settings like these, there will be semantics issues. 
> 
> Besides, there will be a need for global counterpart anyway - since the
> next logical question is how to reset the session defaults? 
> 
> I.e. I want all new sessions to get created with
> sql_default_engine = vinyl, how do I do it?
> 
> Does my point make sense now?
> 
I think all these questions should solved in more global scope -
currently session is just a small object, that contains some
metadata. We cannot save or restore it. As far as I know, there
were some thougths of designing "session". That is all I know,
actually. Not sure that this should be solved in this issue.

As for the global settings - I think we have two ways:
1) Create a normal system space containing all the settings.
2) Create a structure containing these settings and save the
global settings there. Use the same approach as for session
settings after.

The first method looks more standard, but in this case we should
read from space every time we need the value of the setting, or
copy it somewhere else each time setting is changed to speed up
access.

Still, this has not yet been decided.

> > I think that the system view state is the same for all
> > sessions. It is empty, it has the same methods. However, it
> > can give different results, because when it gives tuples,
> > it reads from the session state (current_session()) to
> > create them.
> 
> This is a neat implementation, I agree.
> 
> -- 
> Konstantin Osipov, Moscow, Russia


More information about the Tarantool-patches mailing list