Tree iterators return garbage if an index is modified between calls

Bug #1051006 reported by Kostja Osipov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tarantool
Fix Released
Critical
Kostja Osipov

Bug Description

Tree iterator is not invalidated by deletion from an index:

localhost> lua box.space[16]:insert('a', 'a', 'a')
---
 - 'a': {'a', 'a'}
...
localhost> lua box.space[16]:insert('b', 'b', 'b')
---
 - 'b': {'b', 'b'}
...
localhost> lua box.space[16]:insert('c', 'c', 'c')
---
 - 'c': {'c', 'c'}
...
localhost> lua box.space[16]:insert('d', 'd', 'd')
---
 - 'd': {'d', 'd'}
...
localhost> lua box.space[16]:insert('e', 'e', 'e')
---
 - 'e': {'e', 'e'}
...
localhost> lua k,v = box.space[16].index[1]:next(k)
---
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'a': {'a', 'a'}
...
localhost> lua k,v = box.space[16].index[1]:next(k)
---
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'b': {'b', 'b'}
...
localhost> lua box.space[16]:truncate()
---
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'b': {'b', 'b'}
...
localhost> lua collectgarbage('collect')
---
 - 0
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'b': {'b', 'b'}
...
localhost> lua k,v = box.space[16].index[1]:next(k)
---
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'c': {'c', 'c'}
...
localhost> lua collectgarbage('collect')
---
 - 0
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'c': {'c', 'c'}
...
localhost> lua k,v = box.space[16].index[1]:next(k)
---
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'd': {'d', 'd'}
...
localhost> lua k,v = box.space[16].index[1]:next(k)
---
...
localhost> lua print(k, " ", v)
---
userdata: 0x41544568 'e': {'e', 'e'}
...
localhost> lua k,v = box.space[16].index[1]:next(k)
---
...
localhost> lua print(k, " ", v)
---
nil nil
...
localhost> quit

Revision history for this message
Kostja Osipov (kostja) wrote :

(Use box_big/tarantool.cfg to define space 16 indexes)

Changed in tarantool:
importance: Undecided → Critical
assignee: nobody → Kostja Osipov (kostja)
milestone: none → 1.4.8
status: New → Confirmed
Kostja Osipov (kostja)
Changed in tarantool:
status: Confirmed → Fix Committed
Kostja Osipov (kostja)
Changed in tarantool:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.