Skip to content
Snippets Groups Projects
Commit 64704bb3 authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

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.
parent e40a7958
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment