Only perform causal reads on slaves
The causal read queries were performed also when the target server was the master. The extra functionality of the causal reads is only needed on slaves. Adjusted the test case to require GTID replication.
This commit is contained in:
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
Mariadb_nodes::require_gtid(true);
|
||||||
TestConnections::require_repl_version("10.3.8");
|
TestConnections::require_repl_version("10.3.8");
|
||||||
TestConnections test(argc, argv);
|
TestConnections test(argc, argv);
|
||||||
const int N_QUERIES = 100;
|
const int N_QUERIES = 100;
|
||||||
|
|||||||
@ -1083,8 +1083,10 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
|
|||||||
uint8_t cmd = mxs_mysql_get_command(querybuf);
|
uint8_t cmd = mxs_mysql_get_command(querybuf);
|
||||||
GWBUF *send_buf = gwbuf_clone(querybuf);
|
GWBUF *send_buf = gwbuf_clone(querybuf);
|
||||||
|
|
||||||
if (m_config->causal_reads && cmd == COM_QUERY && !m_gtid_pos.empty())
|
if (m_config->causal_reads && cmd == COM_QUERY && !m_gtid_pos.empty() &&
|
||||||
|
target->is_slave())
|
||||||
{
|
{
|
||||||
|
// Perform the causal read only when the query is routed to a slave
|
||||||
send_buf = add_prefix_wait_gtid(target->server(), send_buf);
|
send_buf = add_prefix_wait_gtid(target->server(), send_buf);
|
||||||
m_wait_gtid = WAITING_FOR_HEADER;
|
m_wait_gtid = WAITING_FOR_HEADER;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user