[tarantool-patches] [PATCH v4 4/5] box: fix memtx_tree_index_build_array_deduplicate

Kirill Shcherbatov kshcherbatov at tarantool.org
Wed Jul 24 15:25:44 MSK 2019


Function memtx_tree_index_build_array_deduplicate worked
incorrectly: when build_array is empty it changed it size to 1.

Follow up #1257
Needed for #1260
---
 src/box/memtx_tree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/box/memtx_tree.c b/src/box/memtx_tree.c
index 41eb6dbec..dc167e113 100644
--- a/src/box/memtx_tree.c
+++ b/src/box/memtx_tree.c
@@ -862,6 +862,8 @@ memtx_tree_index_build_next_multikey(struct index *base, struct tuple *tuple)
 static void
 memtx_tree_index_build_array_deduplicate(struct memtx_tree_index *index)
 {
+	if (index->build_array_size == 0)
+		return;
 	struct key_def *cmp_def = memtx_tree_cmp_def(&index->tree);
 	size_t w_idx = 0, r_idx = 1;
 	while (r_idx < index->build_array_size) {
-- 
2.22.0




More information about the Tarantool-patches mailing list