-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug that deleting record can be found
If a record has fixed size column (e.g. Int32) and it is indexed, the bug is occurred. If a record is deleted, the deleted record can be found index search with 0 value. 0 value for Int32 is 0. This fixes mroonga's bug found at c2b8afce57c89286f8118ebcc5e6260c902c2488.
- Loading branch information
Showing
3 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
test/command/suite/delete/index/fix_size_column.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
table_create Users TABLE_HASH_KEY ShortText | ||
[[0,0.0,0.0],true] | ||
column_create Users age COLUMN_SCALAR UInt8 | ||
[[0,0.0,0.0],true] | ||
table_create Ages TABLE_PAT_KEY UInt8 | ||
[[0,0.0,0.0],true] | ||
column_create Ages users_age COLUMN_INDEX Users age | ||
[[0,0.0,0.0],true] | ||
load --table Users | ||
[ | ||
{"_key": "Alice", "age": 20}, | ||
{"_key": "Bob", "age": 18} | ||
] | ||
[[0,0.0,0.0],2] | ||
select Ages | ||
[ | ||
[ | ||
0, | ||
0.0, | ||
0.0 | ||
], | ||
[ | ||
[ | ||
[ | ||
2 | ||
], | ||
[ | ||
[ | ||
"_id", | ||
"UInt32" | ||
], | ||
[ | ||
"_key", | ||
"UInt8" | ||
], | ||
[ | ||
"users_age", | ||
"Users" | ||
] | ||
], | ||
[ | ||
2, | ||
18, | ||
1 | ||
], | ||
[ | ||
1, | ||
20, | ||
1 | ||
] | ||
] | ||
] | ||
] | ||
select Users --filter 'age == 20' | ||
[ | ||
[ | ||
0, | ||
0.0, | ||
0.0 | ||
], | ||
[ | ||
[ | ||
[ | ||
1 | ||
], | ||
[ | ||
[ | ||
"_id", | ||
"UInt32" | ||
], | ||
[ | ||
"_key", | ||
"ShortText" | ||
], | ||
[ | ||
"age", | ||
"UInt8" | ||
] | ||
], | ||
[ | ||
1, | ||
"Alice", | ||
20 | ||
] | ||
] | ||
] | ||
] | ||
select Users --filter 'age == 0' | ||
[[0,0.0,0.0],[[[0],[["_id","UInt32"],["_key","ShortText"],["age","UInt8"]]]]] | ||
delete Users --filter 'age == 20' | ||
[[0,0.0,0.0],true] | ||
select Ages | ||
[ | ||
[ | ||
0, | ||
0.0, | ||
0.0 | ||
], | ||
[ | ||
[ | ||
[ | ||
2 | ||
], | ||
[ | ||
[ | ||
"_id", | ||
"UInt32" | ||
], | ||
[ | ||
"_key", | ||
"UInt8" | ||
], | ||
[ | ||
"users_age", | ||
"Users" | ||
] | ||
], | ||
[ | ||
2, | ||
18, | ||
1 | ||
], | ||
[ | ||
1, | ||
20, | ||
0 | ||
] | ||
] | ||
] | ||
] | ||
select Users --filter 'age == 20' | ||
[[0,0.0,0.0],[[[0],[["_id","UInt32"],["_key","ShortText"],["age","UInt8"]]]]] | ||
select Users --filter 'age == 0' | ||
[[0,0.0,0.0],[[[0],[["_id","UInt32"],["_key","ShortText"],["age","UInt8"]]]]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
table_create Users TABLE_HASH_KEY ShortText | ||
column_create Users age COLUMN_SCALAR UInt8 | ||
|
||
table_create Ages TABLE_PAT_KEY UInt8 | ||
column_create Ages users_age COLUMN_INDEX Users age | ||
|
||
load --table Users | ||
[ | ||
{"_key": "Alice", "age": 20}, | ||
{"_key": "Bob", "age": 18} | ||
] | ||
|
||
select Ages | ||
select Users --filter 'age == 20' | ||
select Users --filter 'age == 0' | ||
|
||
delete Users --filter 'age == 20' | ||
|
||
select Ages | ||
select Users --filter 'age == 20' | ||
select Users --filter 'age == 0' |