Tarantool development patches archive
 help / color / mirror / Atom feed
From: Mergen Imeev <imeevma@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org,
	tarantool-discussions@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 0/5] Replace control pragmas by SET
Date: Fri, 6 Dec 2019 16:50:09 +0300	[thread overview]
Message-ID: <20191206135009.GA6394@tarantool.org> (raw)
In-Reply-To: <20191206113711.ctzr6x7sqbpr3xkd@tarantool.org>


Hello Kirill!

Below you can see my idea of solving the problem. Also,
after that I will answer your questions.

In the last discussion, we decided to solve the problem more
globally: we are going to create a way to change session settings
that can be used from any interface. So, here are the requirements
for this method:
1) All settings must be in the system space or system view.
2) We should be able to SELECT from this space.
3) We should be able to UPDATE data in this space. INSERT, DELETE
and REPLACE cannot be used on this space.
4) This space should not affect performance.
5) This space should not be involved in transactions.
6) We should be able to change the settings on master and on
replica.
7) Space does not have to be persistent.

To fulfill these requirements, I decided to create and use a new
engine. This engine will only be used for this space. The format
of the space will be {{name = 'name', type = 'string'},
{name = 'value', type = 'any'}}. The space will be temporary.

When the user selects a tuple from space, the space will create a
new tuple on the fly. The space itself will be empty, so do not
worry about performance degradation. On UPDATE, the space will
change the session settings.

After we create the space, we can simply remove the control
pragmas. To change a setting from SQL we just need to
update value in the space using UPDATE statement.


On Fri, Dec 06, 2019 at 02:37:11PM +0300, Kirill Yukhin wrote:
> Hello Mergen!
> 
> On 07 ноя 13:36, imeevma@tarantool.org wrote:
> > The main goal of this set of patches is to replace control pragmas
> > with the SET operator. Control pragmas are those that change SQL
> > settings. Along with this, we will allow to see SQL session-local
> > settings in unified way.
> > 
> > https://github.com/tarantool/tarantool/issues/4511
> > https://github.com/tarantool/tarantool/tree/imeevma/gh-4511-pragma-replaced-by-set
> 
> We have at least two mail threads with discussions of how
> this will be working (PRAGMA and SET keywords).
> 
> We have couple of verbal discussions, could you please
> post approach we developed?
> 
> This is what I can remember: we're introducing new view (say
> _vsettings), which is specific for each sessions.
In the current idea, this is not entirely true. The space
is the same for all sessions. Simply, the tuples it creates
contain the settings for the current session.

> This view should contain all settings which user allowed to
> read and write. Inserts are prohibited to that view. Updates
> are alowed only if user has enough privilages to the given
> setting. E.g. user cannot changes a way FK are checked or
> max nesting depth of a SELECT statement.
Since the user will change the setting of current session,
there won't be any interactions between users/sessions.
> 
> I guess, we should create this view lazily in order not to harm
> performance. Please, make sure when you'll be working on the
> patchset.
In a sense, space will work lazily - it will create a tuple
only when asked about it. The only thing we have to do when
starting Tarantool (not a session!) Is to initialize an
array of settings. Also, we must release it upon exiting
Tarantool.

> 
> Having such a view will alow us to:
>   1. get rid of nasty pragma/set statements at all;
>   2. will simplify connectors programming;
>   3. improve security by allowing to *bind* values we
>      wish to update, instead of concatenating big string
>      like other broken DBMSes.
> 
> AFAIR, we decided to set {'string', 'any'} format for that
> new view.
Yes.

> 
> Could you please summarize overall design and post it here
> (or in discussions, whatever).
> 
> --
> Regards, Kirill Yukhin

  reply	other threads:[~2019-12-06 13:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 10:36 imeevma
2019-11-07 10:36 ` [Tarantool-patches] [PATCH v3 1/5] sysview: make get() and create_iterator() methods virtual imeevma
2019-11-07 10:36 ` [Tarantool-patches] [PATCH v3 2/5] box: introdice _vsession_settings sysview imeevma
2019-11-07 10:36 ` [Tarantool-patches] [PATCH v3 3/5] sql: introduce SET statement imeevma
2019-11-07 12:40   ` Vladislav Shpilevoy
2019-11-07 14:12     ` Mergen Imeev
2019-11-11 21:56       ` Vladislav Shpilevoy
2019-11-15 14:06         ` Mergen Imeev
2019-11-17 17:26           ` Vladislav Shpilevoy
2019-11-17 20:32             ` Vladislav Shpilevoy
2019-11-27 10:33               ` Mergen Imeev
2019-11-27 23:03                 ` Vladislav Shpilevoy
2019-11-27 23:07                   ` Vladislav Shpilevoy
2019-11-27 23:09                     ` Vladislav Shpilevoy
2019-11-28  8:59                     ` Mergen Imeev
2019-11-28  8:56                   ` Mergen Imeev
2019-11-07 10:36 ` [Tarantool-patches] [PATCH v3 4/5] temporary: disable boolean.test.sql imeevma
2019-11-07 10:37 ` [Tarantool-patches] [PATCH v3 5/5] sql: replace control pragmas imeevma
2019-12-06 11:37 ` [Tarantool-patches] [PATCH v3 0/5] Replace control pragmas by SET Kirill Yukhin
2019-12-06 13:50   ` Mergen Imeev [this message]
2019-12-06 14:06     ` Sergey Ostanevich
2019-12-17 22:11     ` Alexander Turenko
2019-12-18  2:39       ` Peter Gulutzan
2019-12-18 17:39         ` Peter Gulutzan
2019-12-19  9:59           ` Mergen Imeev
2019-12-19 17:35             ` Peter Gulutzan
2019-12-19 17:51               ` Mergen Imeev
2019-12-19 21:09           ` Vladislav Shpilevoy
2019-12-18 10:20       ` Kirill Yukhin
2019-12-18 10:53         ` Alexander Turenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191206135009.GA6394@tarantool.org \
    --to=imeevma@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-discussions@dev.tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 0/5] Replace control pragmas by SET' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox