Is there a way to dispatch stored procedure invocation on particular shard, based on sharding key (passed as procedure argument or somehow separately)?
For example we have a table, sharded between 3 nodes using HASH sharding strategy. All rows with key A
are stored on node 1
. I'd like to be sure that when I run procedure(A)
, it applies on node1
.
We are going to use Mysql Fabric tool, but other options considered as well.
Best Answer
Off the wall...
0
, or something irrelevant.Instead of
CALLing
the Procedure, invoke the Function this way:SELECT 0 WHERE key = 'A' AND routine(key);
The hope is that the sharding will kick in for the first part of the
WHERE
and send theSELECT
only to the desired shard.BTW, it appears that Fabric is being decommissioned.