tarantool / tarantool/tarantool
Data is incorrectly recorded in the map
Open
Nobody has claimed this yet.
bug
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
- OS: Linux
- OS Version: Arch Linux
- Architecture: amd64
-> % tarantool -v
Tarantool 2.11.0-0-g247a9a418
Target: Linux-x86_64-RelWithDebInfo
Build options: cmake . -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_BACKTRACE=TRUE
Compiler: GNU-13.1.1
C_FLAGS:-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/tarantool/src=/usr/src/debug/tarantool -flto=auto -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -fopenmp -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/build/tarantool/src/tarantool=. -std=c11 -Wall -Wextra -Wno-gnu-alignof-expression -fno-gnu89-inline -Wno-cast-function-type
CXX_FLAGS:-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/tarantool/src=/usr/src/debug/tarantool -flto=auto -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -fopenmp -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/build/tarantool/src/tarantool=. -std=c++11 -Wall -Wextra -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type
Steps to reproduce
local uuid = require('uuid')
box.cfg({})
local format = {
{
name = 'id',
type = 'uuid'
},
{
name = 'entity',
type = 'map'
},
}
local space = box.schema.create_space('fooBar', {
format = format,
if_not_exists = true
})
space:create_index('id', {
parts = { 'id', },
unique = true,
if_not_exists = true
})
local id = uuid()
local query = [[
INSERT INTO "fooBar" VALUES (CAST(']]..id:str()..[[' AS UUID),
{
'new_fields': {
'subscription': {
'users':false,
'all':true
},
'first_name': 'Vladimir Mayakovsky'
},
'old_fields': {
'subscription':{
'all':false
},
'first_name': 'Eugene Onegin'
}
})]]
local res = box.execute(query)
-- Успешно записалось
if res and res.row_count == 1 then
--
local data = box.space.fooBar:get({id})
print(data[2].new_fields.first_name) -- nil
print(data[2].old_fields.first_name) -- nil
for k, v in pairs(data[2].new_fields) do
print(k, v)
end
end
Actual behavior
first_name was supposed to be recorded.
Expected behavior
print(data[2].new_fields.first_name) -- 'Vladimir Mayakovsky'
print(data[2].old_fields.first_name) -- 'Eugene Onegin'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Lua reproduction using box.execute and the box.space.fooBar:get({id}) lookup, focusing on how the map value is stored and returned. Confirm the result against the expected new_fields.first_name and old_fields.first_name values, then add or run a regression test covering this INSERT path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100