Bad data if incomplete tuple

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

Bug Description

I have the following namespace configuration:

namespace[0].enabled = 1
namespace[0].index[0].type = "HASH"
namespace[0].index[0].unique = 1
namespace[0].index[0].key_field[0].fieldno = 0
namespace[0].index[0].key_field[0].type = "STR"
namespace[0].index[1].type = "TREE"
namespace[0].index[1].unique = 0
namespace[0].index[1].key_field[0].fieldno = 1
namespace[0].index[1].key_field[0].type = "STR"

Since this namespace has 2 keys, the minimal cardinality for an acceptable tuple
must be 2. However, Tarantool/Box accepts incomplete tuples:

tarantool> insert into t0 values ('Britney')
Insert OK, 1 row affected

What is worse, these incomplete tuples always match when the search is made on the second key:

tarantool> select * from t0 where k1='Anything'
Found 1 tuple:
['Britney']

tarantool> insert into t0 values ('Stephanie')
Insert OK, 1 row affected
tarantool> select * from t0 where k1='Anything'
Found 2 tuples:
['Britney']
['Stephanie']

Suggested fix:
- do not accept incomplete tuples. Should we still have a namespace option that allows incomplete tuples, they should not match the search pattern on the second key.

Kostja Osipov (kostja)
Changed in tarantool:
status: New → Confirmed
importance: Undecided → High
milestone: none → 1.3.5
description: updated
Revision history for this message
Kostja Osipov (kostja) wrote :

Whether or not the second namespace is unique does not matter, the result is the same.

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

The returned result is even more obscure if a disjunct is used:

tarantool> select * from t0 where k1='Anything' or k1='More tuples, please'
Found 2 tuples:
['Stephanie']
['Stephanie']

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

If the index is unique, any attempt to insert a tuple with non-zero field in the position of the corrupted index will lead to ERR_CODE_INDEX_VIOLATION, which convinces me that this is a bug.
Additionally, the bug does not occur when there is at least one correct tuple in the namespace already.

Kostja Osipov (kostja)
Changed in tarantool:
status: Confirmed → Fix Committed
assignee: nobody → Kostja Osipov (kostja)
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.