MySQL Group Replication: read your own write across the group

on
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Today is my last day in Asia (China and Taiwan), and between the sessions I had the time to code a small proof-of-concept for people that are asking how they could read their writes on all nodes and ensure the read consistency with their last write ?

The usual (and easier) answer to this particular question is to read on the same host you just wrote. But currently MySQL provides you all the elements to force a consistent read across all the nodes of a group.

Since MySQL 5.7.5, we introduced session_track_gtidsand in 5.7.6 we also introduced  GTIDs context to the OK packet (session tracker) (WL#6128 and WL#6972). So we can use this implementation in correlation with WAIT_FOR_EXECUTED_GTID_SET to force a consistent read.

Currently this solution must be implemented in your application but a tool like ProxySQL might be able to implement this too.

I wrote a small C program using Connector/C to illustrate this: gr_ryow.c

Let’s see this small C program in action:

Of course as we are aware of this request and we might come one day with an easier solution implemented only in the server or the router, but for the moment this already an option for those willing to read their own writes across all members.

 

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

One thought on “MySQL Group Replication: read your own write across the group

Leave a Reply

Your email address will not be published. Required fields are marked *

recent

Last Tweets Last Tweets

Locations of visitors to this page
categories