vinyl: implement multikey index support
In case of multikey indexes, we use vy_entry.hint to store multikey array entry index instead of a comparison hint. So all we need to do is patch all places where a statement is inserted so that in case the key definition is multikey we iterate over all multikey indexes and insert an entry for each of them. The rest will be done automatically as vinyl stores and compares vy_entry objects, which have hints built-in, while comparators and other generic functions have already been patched to treat hints as multikey indexes. There are just a few places we need to patch: - vy_tx_set, which inserts a statement into a transaction write set. - vy_build_insert_stmt, which is used to fill the new index on index creation and DDL recovery. - vy_build_on_replace, which forwards modifications done to the space during index creation to the new index. - vy_check_is_unique_secondary, which checks a secondary index for conflicts on insertion of a new statement. - vy_tx_handle_deferred_delete, which generates deferred DELETE statements if the old tuple is found in memory or in cache. - vy_deferred_delete_on_replace, which applies deferred DELETEs on compaction. Plus, we need to teach vy_get_by_secondary_tuple to match a full multikey tuple to a partial multikey tuple or a key, which implies iterating over all multikey indexes of the full tuple and comparing them to the corresponding entries to the partial tuple. We already have tests that check the functionality for memtx. Enable and tweak it a little so that it can be used for vinyl as well.
Showing
- src/box/vinyl.c 81 additions, 62 deletionssrc/box/vinyl.c
- src/box/vy_stmt.h 25 additions, 0 deletionssrc/box/vy_stmt.h
- src/box/vy_tx.c 32 additions, 11 deletionssrc/box/vy_tx.c
- src/box/vy_tx.h 2 additions, 17 deletionssrc/box/vy_tx.h
- test/box/bitset.result 15 additions, 0 deletionstest/box/bitset.result
- test/box/bitset.test.lua 6 additions, 0 deletionstest/box/bitset.test.lua
- test/box/hash.result 15 additions, 0 deletionstest/box/hash.result
- test/box/hash.test.lua 6 additions, 0 deletionstest/box/hash.test.lua
- test/box/rtree_misc.result 15 additions, 0 deletionstest/box/rtree_misc.result
- test/box/rtree_misc.test.lua 6 additions, 0 deletionstest/box/rtree_misc.test.lua
- test/engine/engine.cfg 0 additions, 3 deletionstest/engine/engine.cfg
- test/engine/multikey.result 3 additions, 37 deletionstest/engine/multikey.result
- test/engine/multikey.test.lua 3 additions, 13 deletionstest/engine/multikey.test.lua
Loading
Please register or sign in to comment