Skip to content

Invalid IPROTO_INDEX_NAME mapping on the server side. #9923

@oleg-jukovec

Description

@oleg-jukovec

Bug description

The server could not correctly map an index from a string passed with IPROTO_INDEX_NAME to a number.
I found the problem with the tarantool/go-tarantool connector, but I'm able to reproduce it with net.box.

  • OS: Arhclinux
  • Architecture: amd64

Place tarantool --version output here.

$ tarantool --version
Tarantool 3.1.0-entrypoint-214-ge048a5021
Target: Linux-x86_64-Debug
Build options: cmake . -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_BACKTRACE=TRUE
Compiler: GNU-13.2.1
C_FLAGS: -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/home/ozi/src/tarantool=. -std=c11 -Wall -Wextra -Wno-gnu-alignof-expression -fno-gnu89-inline -Wno-cast-function-type -Werror -g -ggdb -O0 
CXX_FLAGS: -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/home/ozi/src/tarantool=. -std=c++11 -Wall -Wextra -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type -Werror -g -ggdb -O0

Steps to reproduce

  1. Run the script with tarantool -i:
box.cfg({
    listen = "localhost:3013",
})
box.once("init", function()
    local s = box.schema.space.create('test', {
        id = 621,
        temporary = true,
        if_not_exists = true,
        field_count = 3,
        format = {
            {name = "id", type = "unsigned"},
            {name = "name", type = "string"},
            {name = "arr1", type = "array"},
        },
    })
    s:create_index('primary', {
        type = 'tree',
        unique = true,
        parts = {1, 'unsigned'},
        if_not_exists = true
    })
    s:create_index('secondary', {
        id = 5, type = 'tree',
        unique = false,
        parts = {2, 'string'},
        if_not_exists = true
    })

    box.schema.user.create('test', {password = 'test'})
    box.schema.user.grant('test', 'execute', 'universe')
    box.schema.user.grant('test', 'read,write', 'space', 'test')
end)
  1. Run a Tarantool in the second console and execute:
tarantool> conn = require('net.box').connect("localhost:3013", {user = 'test', password = 'test', fetch_schema = false})
---
...

tarantool> conn.space.test.index.secondary:select()
---
- error: 'No index #1 is defined in space ''test'''
...

tarantool> conn.space.test.index[5]:select()
---
- []
...

Actual behavior

The server does not correctly map an index id by an index name passed with IPROTO_INDEX_NAME.

Expected behavior

The server selects data from an index with a name passed with IPROTO_INDEX_NAME.

Metadata

Metadata

Assignees

Labels

3.2Target is 3.2 and all newer release/master branchesbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions