auto-sharding: distributed writes
At present, a distributed table can only manage select and update operations. The goal is to enable it to process insert, replace, and delete operations as well.
Here is a high-level specification of the desired functionality:
When writing to a distributed table with the following configuration: t type='distributed' local='t_2' local='t_1' agent='<node3>:t_3|<node1>:t_3':
- Route each document to its appropriate shard based on its ID
- If a shard is unavailable but has a mirror, use the mirror as a failover
- Clearly indicate in the error message which data was not processed if a shard returns an error while attempting to insert/replace a batch
- Prevent routing write queries to a node that is currently a replication donor to avoid stalls
Before implementing this task, a more comprehensive and detailed specification is necessary. Some questions to consider include:
- Which sharding method should be employed?
- If we have to store a shards map in Manticore, what's the best option for that? Should it be a Manticore RT table, a hidden table? How can a table be hidden in Manticore?
- How can we determine if an agent is a replication donor? Should it fail on that side and then trigger a retry?
It is essential to review and consider the discussions and decisions from https://gitlab.com/manticoresearch/dev/-/issues/1748 before proceeding. https://gitlab.com/manticoresearch/dev/-/issues/2935#note_1151535983 is also worth reading to understand the whole auto-sharding idea.
➤ Sergey Nikolaev commented:
Ilya suggested the idea of implementing the whole auto-sharding functionality in Manticore Buddy with optional implementation of hot places in C++ and using them from PHP. It's to be discussed.
I can't access the links from above: https://gitlab.com/manticoresearch/dev/-/issues/1748 https://gitlab.com/manticoresearch/dev/-/issues/2935#note_1151535983
Blocked by https://github.com/manticoresoftware/manticoresearch-buddy/issues/392
https://github.com/manticoresoftware/manticoresearch-buddy/issues/392 has been addressed 👍
So we are unblocked to make progress here 😃
This will help with https://github.com/manticoresoftware/manticoresearch-php/issues/217
Blocked by: https://github.com/manticoresoftware/manticoresearch-buddy/issues/160
Upcoming docs:
- https://github.com/manticoresoftware/manticoresearch/blob/d6e65c93f2e4575f2168d42a46bc3162f7e9ba4b/manual/Creating_a_table/Creating_a_sharded_table/Creating_a_sharded_table.md
- https://github.com/manticoresoftware/manticoresearch/blob/d6e65c93f2e4575f2168d42a46bc3162f7e9ba4b/manual/Creating_a_table/Creating_a_sharded_table/Table_sharding_current_limitations.md
- https://github.com/manticoresoftware/manticoresearch/pull/2084