Any idea why we’d be getting select queries to our master DB?
There are a few reasons this could happen.
1. Whe most obvious one is that the read priority for the master is set to something > 0. What do you have the read priority set to in your configuration?
2. HyperDB sends reads to the master for a given table on a single pageload if there was an update to that table on the same pageload. So for example, if you UPDATE wp_options and then SELECT from wp_options 10 times on the same page, those 10 SELECTs would go to the master, even if the read priority is set to 0. This is because it’s very likely the latest changes haven’t been replicated if you are using asynchronous (the default) replication in MariaDB. If you’re interested how this part of the code works, look for where $this->srtm
is set to true in the HyperDB source code.
3. Your code is explicitly setting $this->srtm
to true either by calling send_reads_to_masters()
or some other way.
Hope this is helpful, let us know what you find after reviewing your configuration and code.