Merge branch 'MXS-171' into develop

This commit is contained in:
Markus Makela
2015-06-29 12:04:43 +03:00
3 changed files with 14 additions and 1 deletions

View File

@ -93,6 +93,13 @@ disable_sescmd_history=true
disable_slave_recovery=true
```
**`master_accept_reads`** allows the master server to be used for reads. This is a useful option to enable if you are using a small number of servers and wish to use the master for reads as well.
```
# Use the master for reads
master_accept_reads=true
```
## Limitations
In Master-Slave replication cluster also read-only queries are routed to master too in the following situations:

View File

@ -252,6 +252,7 @@ typedef struct rwsplit_config_st {
int rw_max_sescmd_history_size;
bool disable_sescmd_hist;
bool disable_slave_recovery;
bool master_reads; /*< Use master for reads */
} rwsplit_config_t;

View File

@ -1244,7 +1244,8 @@ static bool get_dcb(
SERVER_IS_SLAVE(b->backend_server) &&
(max_rlag == MAX_RLAG_UNDEFINED ||
(b->backend_server->rlag != MAX_RLAG_NOT_AVAILABLE &&
b->backend_server->rlag <= max_rlag)))
b->backend_server->rlag <= max_rlag)) &&
!rses->rses_config.master_reads)
{
/** found slave */
candidate_bref = &backend_ref[i];
@ -4589,6 +4590,10 @@ static void rwsplit_process_router_options(
{
router->rwsplit_config.disable_slave_recovery = config_truth_value(value);
}
else if(strcmp(options[i],"master_accept_reads") == 0)
{
router->rwsplit_config.master_reads = config_truth_value(value);
}
}
} /*< for */
}