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:
@ -1083,8 +1083,10 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
|
||||
uint8_t cmd = mxs_mysql_get_command(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);
|
||||
m_wait_gtid = WAITING_FOR_HEADER;
|
||||
}
|
||||
|
Reference in New Issue
Block a user