Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable implicit box.cfg{} in sql #4726

Closed
Mons opened this issue Jan 14, 2020 · 8 comments · Fixed by #7786
Closed

Disable implicit box.cfg{} in sql #4726

Mons opened this issue Jan 14, 2020 · 8 comments · Fixed by #7786
Assignees
Labels
2.11 Target is 2.11 and all newer release/master branches

Comments

@Mons
Copy link
Contributor

Mons commented Jan 14, 2020

In #3266 there were added implicit empty box.cfg{} to box.execute

At first, this behavior differs from other functions like box.select etc.
At second, this could be harmful, because calling empty box.cfg will start an instance without replication in readwrite mode, which, in case, could lead to unintended background data modification

I could not see a reason for implicit cfg inside sql and I insist on strict requirement of explicit box.cfg from box.execute

@Gerold103
Copy link
Collaborator

There was a certain reason to add auto box.cfg - interactive SQL console. In the SQL console you can't call box.cfg{}. Its auto call in the console should be preserved.

@kyukhin
Copy link
Contributor

kyukhin commented Jan 16, 2020

Maybe there's a way to do implicit cfg{} in interactive mode only?

@kyukhin kyukhin pinned this issue Jan 16, 2020
@kyukhin kyukhin added discussion needs feedback Something is unclear with the issue labels Jan 16, 2020
@kyukhin kyukhin unpinned this issue Jan 16, 2020
@Gerold103
Copy link
Collaborator

There is. Just patch console.lua to call box.cfg in case SQL language is active, and it was not called before a first request.

@Totktonada
Copy link
Member

It is possible now using built-in LUA function:

SELECT lua('box.cfg{listen = 3301} return true')

See tarantool/doc#879

@kyukhin kyukhin added this to the wishlist milestone May 22, 2020
@igormunkin
Copy link
Collaborator

I found the following example today:

$ ./src/tarantool
Tarantool 2.5.0-98-ge215737a9
type 'help' for interactive help
tarantool> \set language sql
---
- true
...

tarantool> SELECT 1
2020-06-03 23:51:55.373 [20388] main/103/interactive C> Tarantool 2.5.0-98-ge215737a9
2020-06-03 23:51:55.373 [20388] main/103/interactive C> log level 5
2020-06-03 23:51:55.374 [20388] main/103/interactive I> mapping 268435456 bytes for memtx tuple arena...
2020-06-03 23:51:55.374 [20388] main/103/interactive I> mapping 134217728 bytes for vinyl tuple arena...
2020-06-03 23:51:55.380 [20388] main/103/interactive I> instance uuid 8a4ec0ff-590b-4a68-b2b8-4edcfa49d35c
2020-06-03 23:51:55.380 [20388] main/103/interactive I> initializing an empty data directory
2020-06-03 23:51:55.405 [20388] main/103/interactive I> assigned id 1 to replica 8a4ec0ff-590b-4a68-b2b8-4edcfa49d35c
2020-06-03 23:51:55.405 [20388] main/103/interactive I> cluster uuid f7a600e4-4913-43b1-aec4-02ec9e4fb45a
2020-06-03 23:51:55.406 [20388] snapshot/101/main I> saving snapshot `./00000000000000000000.snap.inprogress'
2020-06-03 23:51:55.439 [20388] snapshot/101/main I> done
2020-06-03 23:51:55.440 [20388] main/103/interactive I> ready to accept requests
2020-06-03 23:51:55.440 [20388] main/105/checkpoint_daemon I> scheduled next checkpoint for Thu Jun  4 01:04:01 2020
---
- metadata:
  - name: '1'
    type: integer
  rows:
  - [1]
...

tarantool> SELECT lua('box.cfg{log="tarantool.log"} return true')
---
- null
- Can't set option 'log' dynamically
...

@Totktonada
Copy link
Member

@igormunkin log is not a dynamic option.

$ tarantool
Tarantool 2.5.0-62-gbb7c3d167
type 'help' for interactive help
tarantool> box.cfg{}
<...>
tarantool> box.cfg{log = 'log.txt'}
---
- error: Can't set option 'log' dynamically
...

Are you want to highlight that we're unable to tune a non-dynamic option after a box.execute(<...>) call (as well as after box.cfg(<...>) call)?

@igormunkin
Copy link
Collaborator

Are you want to highlight that we're unable to tune a non-dynamic option after a box.execute(<...>)call (as well as after box.cfg(<...>) call)?

Precisely.

@Totktonada
Copy link
Member

I don't have an opinion regarding which decision would be better here, but I want to note that it may depend on other activities around box.cfg(). Cited from my email re #4231:

Also I'm not sure that disabling implicit box.cfg() is the right
direction. Maybe we should make all box.cfg() options dynamically
configurable, allow to join a cluster with initial snapshot (after very
first box.cfg()), dynamically adjust memtx_memory if it is not set
explicitly and make other improvements for user's convenience.

I have no opinion here, just noted that it is not so clear as it may
look at first glance.

@igormunkin igormunkin removed this from the wishlist milestone Oct 2, 2022
@igormunkin igormunkin added the 2.11 Target is 2.11 and all newer release/master branches label Oct 2, 2022
ImeevMA added a commit to ImeevMA/tarantool that referenced this issue Oct 7, 2022
Prior to this patch, it was possible to call box.execute() before BOX
was initialized, i.e. before calling box.cfg(). This, however, caused
box.cfg() to be called automatically, which could be problematic as some
parameters could not be changed after box.cfg() was called. After this
patch, box.execute() will only be available when the BOX has been
initialized.

Closes tarantool#4726

@TarantoolBot document
Title: box.execute() now available only after initialization of BOX
Previously, it was possible to call box.execute() before the BOX was
configured, in which case the BOX was configured automatically, which
could lead to problems with BOX parameters. Now box.execute() can only
be called after the BOX has been properly configured.
ImeevMA added a commit to ImeevMA/tarantool that referenced this issue Oct 7, 2022
Prior to this patch, it was possible to call box.execute() before BOX
was initialized, i.e. before calling box.cfg(). This, however, caused
box.cfg() to be called automatically, which could be problematic as some
parameters could not be changed after box.cfg() was called. After this
patch, box.execute() will only be available when the BOX has been
initialized.

Closes tarantool#4726

@TarantoolBot document
Title: box.execute() now available only after initialization of BOX
Previously, it was possible to call box.execute() before the BOX was
configured, in which case the BOX was configured automatically, which
could lead to problems with BOX parameters. Now box.execute() can only
be called after the BOX has been properly configured.

It is also forbidden to set language to SQL in a console with an
unconfigured BOX.
ImeevMA added a commit to ImeevMA/tarantool that referenced this issue Oct 11, 2022
Prior to this patch, it was possible to call box.execute() before BOX
was initialized, i.e. before calling box.cfg(). This, however, caused
box.cfg() to be called automatically, which could be problematic as some
parameters could not be changed after box.cfg() was called. After this
patch, box.execute() will only be available when the BOX has been
initialized.

Closes tarantool#4726

@TarantoolBot document
Title: box.execute() now available only after initialization of BOX
Previously, it was possible to call box.execute() before the BOX was
configured, in which case the BOX was configured automatically, which
could lead to problems with BOX parameters. Now box.execute() can only
be called after the BOX has been properly configured.

It is also forbidden to set language to SQL in a console with an
unconfigured BOX.
ImeevMA added a commit to ImeevMA/tarantool that referenced this issue Oct 11, 2022
Prior to this patch, it was possible to call box.execute() before BOX
was initialized, i.e. before calling box.cfg(). This, however, caused
box.cfg() to be called automatically, which could be problematic as some
parameters could not be changed after box.cfg() was called. After this
patch, box.execute() will only be available when the BOX has been
initialized.

Closes tarantool#4726

@TarantoolBot document
Title: box.execute() now available only after initialization of BOX
Previously, it was possible to call box.execute() before the BOX was
configured, in which case the BOX was configured automatically, which
could lead to problems with BOX parameters. Now box.execute() can only
be called after the BOX has been properly configured.

It is also forbidden to set language to SQL in a console with an
unconfigured BOX.
ImeevMA added a commit to ImeevMA/tarantool that referenced this issue Oct 12, 2022
Prior to this patch, it was possible to call box.execute() before box
was initialized, i.e. before calling box.cfg(). This, however, caused
box.cfg() to be called automatically, which could be problematic as some
parameters could not be changed after box.cfg() was called. After this
patch, box.execute() will only be available when the box has been
initialized.

Closes tarantool#4726

@TarantoolBot document
Title: box.execute() now available only after initialization of box

Previously, it was possible to call box.execute() before the box was
configured, in which case the box was configured automatically, which
could lead to problems with box parameters. Now box.execute() can only
be called after the box has been properly configured.

It is also forbidden to set language to SQL in a console with an
unconfigured box.
ImeevMA added a commit to ImeevMA/tarantool that referenced this issue Oct 13, 2022
Prior to this patch, it was possible to call box.execute() before box
was initialized, i.e. before calling box.cfg(). This, however, caused
box.cfg() to be called automatically, which could be problematic as some
parameters could not be changed after box.cfg() was called. After this
patch, box.execute() will only be available when the box has been
initialized.

Closes tarantool#4726

@TarantoolBot document
Title: box.execute() now available only after initialization of box

Previously, it was possible to call box.execute() before the box was
configured, in which case the box was configured automatically, which
could lead to problems with box parameters. Now box.execute() can only
be called after the box has been properly configured.

It is also forbidden to set language to SQL in a console with an
unconfigured box.
locker pushed a commit that referenced this issue Oct 13, 2022
Prior to this patch, it was possible to call box.execute() before box
was initialized, i.e. before calling box.cfg(). This, however, caused
box.cfg() to be called automatically, which could be problematic as some
parameters could not be changed after box.cfg() was called. After this
patch, box.execute() will only be available when the box has been
initialized.

Closes #4726

@TarantoolBot document
Title: box.execute() now available only after initialization of box

Previously, it was possible to call box.execute() before the box was
configured, in which case the box was configured automatically, which
could lead to problems with box parameters. Now box.execute() can only
be called after the box has been properly configured.

It is also forbidden to set language to SQL in a console with an
unconfigured box.
@igormunkin igormunkin removed needs feedback Something is unclear with the issue discussion labels Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.11 Target is 2.11 and all newer release/master branches
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants