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

Mergen Imeev imeevma at tarantool.org
Wed Nov 27 13:52:06 MSK 2019


On Wed, Nov 27, 2019 at 01:34:32PM +0300, Konstantin Osipov wrote:
> Pragmas are of course a dead end, but pragmas themselves are
> unimportant, so it's still unclear why one should bother about them,
> as opposed to, for example, caring about foreign key checks for all
> front ends.
> 
> But fine, assuming one wants to remove prgamas, adding extra overhead
> to session management is a bad idea. One could have a global sysview
> _vsettings with all the settings, perhaps even ones from box.cfg, and
> that would be enough.

Hi! Thanks for the review. However, I think you are a little
wrong. We do not save these settings anywhere except for the
struct session. When a user reads from the space, it creates
tuples on the fly and passes them to the user. All of this can
actually be read from the commit-message:


box: introduce _vsession_settings sysview

This patch creates the _vsession_settings sysview. This sysview
contains names and values of the session settings.

This sysview creates tuples on the fly using its own get() and
create_iterator() methods. This allows us to get a tuple without
having to save it anywhere. But this means that every time we get
a tuple from this system view, it is a new tuple, even if they
look the same:

tarantool> v = box.space._vsession_settings
tarantool> v:get({'sql_default_engine'}) ~= v:get({'sql_default_engine'})
---
- true
...

Currently, only SQL settings can be extracted from this sysview,
since the only session settings are SQL settings.

Part of #4511

@TarantoolBot document
Title: _vsession_settings system view
_vsession_settings sysview is used to get the current session
settings. List of currently available session settings:

sql_default_engine
sql_defer_foreign_keys
sql_full_column_names
sql_recursive_triggers
sql_reverse_unordered_selects

Debug build also have debug settings that could be obtained from
this sysview:

sql_parser_trace
sql_select_trace
sql_trace
sql_vdbe_addoptrace
sql_vdbe_debug
sql_vdbe_eqp
sql_vdbe_listing
sql_vdbe_trace
sql_where_trace

Example of usage:
tarantool> box.space._vsession_settings:get({'sql_default_engine'})
---
- ['sql_default_engine', 'memtx']
...

tarantool> box.space._vsession_settings:select()
---
- - ['sql_default_engine', 'memtx']
- ['sql_defer_foreign_keys', false]
- ['sql_full_column_names', false]
- ['sql_recursive_triggers', true]
- ['sql_reverse_unordered_selects', false]
...

tarantool> box.space._vsession_settings:select('sql_g', {iterator='LE'})
---
- - ['sql_full_column_names', false]
- ['sql_defer_foreign_keys', false]
- ['sql_default_engine', 'memtx']
...



More information about the Tarantool-patches mailing list