-
-
This would not be really usable for what we need to do in the end.
We need to have all the queries of a specific call to be run on master.With this approach, I would need to modify all the DAOs to use run_on_last_used (after having set the first call to be run on master)
And it would be really fragile, if another query gets added later without the run_on_last_used, it would break the following ones. -
I think better than this hacky approach would then simply be to use different connection classes.
For example something like this:
$db = $this->locator->masterconnection() $this->locator->override('mysqlconnection', $db);
the only requirement for this to work is that this needs to be done before any DAO is instantiated.
-
yep it looks better to me than all the other options we considered
-
-
[RFC][Lunr] Gravity: add flag to persist MySQL query hint
Review Request #489 — Created Jan. 27, 2017 and discarded
Information | |
---|---|
tardypad | |
Lunr | |
mysql_connection_persist_query_hint | |
Reviewers | |
lunr | |
Not really happy with this solution because it might be confusing in its usage in the following scenario for example:
- run_on_master with persist on
- all the following queries are then run on master (as expected)
- run_on_slave with persist off
- next query is run on the slave (as expected)
- following queries are run either on master or slave (not sure if this is expected)Maybe it is better to keep the run_on_master, run_on_slave,... functions only affecting the next query
And have a separate "global query hint" property management:
- new property global_query_hint with master/slave setter functions
- the query functions would use that global query hint by default unless there is a temporary one set from the run_on_master/slave functions
none