Details
-
New Feature
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Hi,
Imagine we have 3 routers:
1. Write router (readconnroute with router_option=master)
2. Read router (readconnroute with router_option=slave and max_slave_replication_lag=10)
3. Read router (readconnroute with router_option=slave and no max_slave_replication_lag param)
Some reads in the application cannot handle replication lag. If all slaves have replication lag, we want to route it to the master.
Some other reads have less problems if they are stale. In other words, if there are no slaves without replication lag we want these queries to be redirected to all slaves, regardless of their replication lag.
While (I think?) it is possible to make a readconnroute with 2 servers which point to these maxscale listeners this adds a lot of overhead. I think it is useful to have a router that forwards to to other routers.
I can imagine there are many other use cases with chaining services. This feature would, for example, allow readwritesplit to be used in combination with simple schema sharding.
Or, if you have a two-datacenter Galera cluster, you can use use weighting in each datacenter, or readwritesplit in the disaster recovery datacenter.
So:
[Write Service]
type=router
service=readconnroute
router_options=master
[In Sync Slaves]
type=router
service=readconnroute
router_options=slave
max_replication_lag=10
[All Slaves]
type=router
service=readconnroute
router_options=slave
[Possibly Stale Read Service]
type=router
service=readconnroute
router_options=first_available
routers=In Sync Slaves,All Slaves
[In Sync Read Service]
type=router
service=readconnroute
router_options=first_available
routers=In Sync Slaves,Write Service
In this example we can also rename 'routers' to 'servers' but that doesn't really cover the value. Perhaps we can make the 2 words interchangeable?
Thank you,
Michaël