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

Assertion when reading a temporary space #4139

Closed
pgulutzan opened this issue Apr 11, 2019 · 0 comments
Closed

Assertion when reading a temporary space #4139

pgulutzan opened this issue Apr 11, 2019 · 0 comments
Assignees
Labels
bug Something isn't working crash sql
Milestone

Comments

@pgulutzan
Copy link
Contributor

I have Ubuntu 18.04. I have Tarantool 2.2, pulled from source today.
I have a new database.

For the sake of an information_schema substitute, I made this function:

function _COLUMNS_CREATE()
local temporary_space_name
local spaces = {}
local is_nullable
temporary_space_name = 'COLUMNS' .. box.info.id
if #box.space._space.index.name:select(temporary_space_name) > 0 then
box.space[temporary_space_name]:drop()
end
box.schema.space.create(temporary_space_name,{engine='memtx',temporary=true})
box.space[temporary_space_name]:format({
{name = 'TABLE_NAME', type = 'string'},
{name = 'COLUMN_NAME', type = 'string'},
{name = 'ORDINAL_POSITION', type = 'unsigned'},
{name = 'IS_NULLABLE', type = 'integer'},
{name = 'DATA_TYPE', type = 'string'}
})
box.space[temporary_space_name]:create_index('I',{parts={1,'string',2,'string'}})
box.space[temporary_space_name]:truncate()
spaces = box.space._space:select()
for i=1,#spaces do
for j=1,#spaces[i][7] do
is_nullable = 0
if spaces[i][7][j].is_nullable then is_nullable = 1 end
box.space[temporary_space_name]:insert{
spaces[i].name,
spaces[i][7][j].name,
j,
is_nullable,
spaces[i][7][j].type}
end
end
return temporary_space_name
end

That succeeds. Then I run the function ...

"
tarantool> _COLUMNS_CREATE()

  • _COLUMNS_1
    ...
    "

That succeeds. Then I select, using the table name that the function returned.

tarantool> box.execute([[SELECT * FROM _COLUMNS_1;]])
tarantool: /home/pgulutzan/tarantool-2.2/src/box/sql/build.c:2780: sqlSrcListDelete: Assertion `pItem->space == NULL || !pItem->space->def->opts.is_temporary || (pItem->space->index == NULL && pItem->space->def->opts.checks == NULL)' failed.
Aborted (core dumped)

That failed.

If I do not say "temporary=true" when I create the space, the SELECT succeeds.

If I say "box.space._COLUMNS_1:select()", the select succeeds.

@pgulutzan pgulutzan added the sql label Apr 11, 2019
@kyukhin kyukhin added bug Something isn't working crash labels May 17, 2019
@kyukhin kyukhin added this to the 2.1.3 milestone May 17, 2019
ImeevMA added a commit that referenced this issue May 17, 2019
At some point, it became possible to use SELECT on spaces created
in Lua. Since it is allowed to create temporary spaces in Lua,
this led to an error. To avoid this error, now not all temporary
spaces are checked, but only ephemeral spaces.

Close #4139
ImeevMA added a commit that referenced this issue May 21, 2019
Up to this point, the is_temporary flag has been set in all
ephemeral spaces.

At some point, it became possible to use spaces created in Lua in
SQL statements. Since it is allowed to create temporary spaces in
Lua, not all temporary spaces in SQL are ephemeral. To separate
the temporary and ephemeral spaces, is_ephemeral flag is now set
in the ephemeral spaces and is_temporary flag is not set.

Close #4139
Korablev77 pushed a commit that referenced this issue May 25, 2019
Up to this point, the is_temporary flag has been set for surrogate space
definitions used to transfer meta-information during compilation stage
of DML queries (CREATE TABLE/INDEX etc).

At some point, it became possible to use spaces created in Lua in
SQL statements. Since it is allowed to create temporary spaces in
Lua, not all temporary spaces in SQL are surrogate wrappers. To separate
real temporary spaces (i.e. which came from space cache) from surrogate
ones, is_ephemeral flag is now set in such spaces instead of
is_temporary. Note that there can't be mess between these flags since
ephemeral spaces can exist only during execution of VDBE bytecode.
Also note that flag is required only for debugging facilities.

Close #4139
ImeevMA added a commit that referenced this issue May 30, 2019
Up to this point, the is_temporary flag has been set for surrogate space
definitions used to transfer meta-information during compilation stage
of DML queries (CREATE TABLE/INDEX etc).

At some point, it became possible to use spaces created in Lua in
SQL statements. Since it is allowed to create temporary spaces in
Lua, not all temporary spaces in SQL are surrogate wrappers. To separate
real temporary spaces (i.e. which came from space cache) from surrogate
ones, is_ephemeral flag is now set in such spaces instead of
is_temporary. Note that there can't be mess between these flags since
ephemeral spaces can exist only during execution of VDBE bytecode.
Also note that flag is required only for debugging facilities.

Close #4139
ImeevMA added a commit that referenced this issue Jun 6, 2019
Up to this point, the is_temporary flag has been set for surrogate space
definitions used to transfer meta-information during compilation stage
of DML queries (CREATE TABLE/INDEX etc).

At some point, it became possible to use spaces created in Lua in
SQL statements. Since it is allowed to create temporary spaces in
Lua, not all temporary spaces in SQL are surrogate wrappers. To separate
real temporary spaces (i.e. which came from space cache) from surrogate
ones, is_ephemeral flag is now set in such spaces instead of
is_temporary. Note that there can't be mess between these flags since
ephemeral spaces can exist only during execution of VDBE bytecode.
Also note that flag is required only for debugging facilities.

Close #4139
@kyukhin kyukhin closed this as completed in 2777828 Jun 7, 2019
kyukhin pushed a commit that referenced this issue Jun 7, 2019
Up to this point, the is_temporary flag has been set for surrogate space
definitions used to transfer meta-information during compilation stage
of DML queries (CREATE TABLE/INDEX etc).

At some point, it became possible to use spaces created in Lua in
SQL statements. Since it is allowed to create temporary spaces in
Lua, not all temporary spaces in SQL are surrogate wrappers. To separate
real temporary spaces (i.e. which came from space cache) from surrogate
ones, is_ephemeral flag is now set in such spaces instead of
is_temporary. Note that there can't be mess between these flags since
ephemeral spaces can exist only during execution of VDBE bytecode.
Also note that flag is required only for debugging facilities.

Close #4139

(cherry picked from commit 2777828)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash sql
Projects
None yet
Development

No branches or pull requests

3 participants