manticoresearch icon indicating copy to clipboard operation
manticoresearch copied to clipboard

auto-sharding: distributed writes

Open githubmanticore opened this issue 2 years ago • 6 comments

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.

githubmanticore avatar Apr 03 '23 03:04 githubmanticore

➤ 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.

githubmanticore avatar Apr 11 '23 05:04 githubmanticore

I can't access the links from above: https://gitlab.com/manticoresearch/dev/-/issues/1748 https://gitlab.com/manticoresearch/dev/-/issues/2935#note_1151535983

marclaporte avatar Sep 24 '24 03:09 marclaporte

Blocked by https://github.com/manticoresoftware/manticoresearch-buddy/issues/392

sanikolaev avatar Nov 25 '24 06:11 sanikolaev

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

marclaporte avatar Mar 21 '25 16:03 marclaporte

Blocked by: https://github.com/manticoresoftware/manticoresearch-buddy/issues/160

donhardman avatar Mar 28 '25 14:03 donhardman

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

marclaporte avatar May 21 '25 11:05 marclaporte