Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use custom sharding key to calculate bucket id
Previously there were two different ways to obtain bucket id in CRUD: - calculate bucket id automatically using primary key (default) - pass it from outside explicitly in options on CRUD operation call Users who uses DDL module [1] may specify sharding key (that are actually names of tuple fields), but it was not possible to use DDL sharding key for bucket id calculation. Now CRUD allows to use that custom sharding key to calculate bucket id, it will be done automatically when used DDL schema with non-empty sharding_key [1] or when space _ddl_sharding_key contains a tuple with space name and it's sharding key. Table below describe what operations supports custom sharding key: | CRUD method | Added sharding key support | | ---------------------------- | -------------------------- | | get() | Yes | | insert() / insert_object() | Yes | | delete() | Yes | | replace() / replace_object() | Yes | | upsert() / upsert_object() | Yes | | select() / pairs() | Yes | | update() | Yes | | upsert() / upsert_object() | Yes | | replace() / replace_object() | Yes | | min() / max() | No (not required) | | cut_rows() / cut_objects() | No (not required) | | truncate() | No (not required) | | len() | No (not required) | Limitations: - It's not possible to update sharding keys automatically when schema is updated on storages, see [2]. However it is possible to do it manually with sharding_key.update_sharding_keys_cache(). - CRUD select may lead map reduce in some cases, see [3]. 1. https://github.com/tarantool/ddl 2. #212 3. #213 Closes #166
- Loading branch information