Moved written table timestamping from query_start() to query_end():
We are adjusting table last written times at the end of transaction.
That does not apply to immediate database writes that are not performed
within transaction. This change is to set last written time after the query
has finished for such writes, rather than before it started. That way
long write operations cannot spill over the latency parameter.
In practice it is as if the feature was turned off most of the time.
However, some long processes may benefit from this very safe value
in case admins missed to configure it.
moodle_database::commit_delegated_transaction() calls
core\event\manager::database_transaction_commited() which may invoke
events that do database reads.
This change adjusts tables last written time in moodle_read_slave_trait *before*
calling moodle_database::commit_delegated_transaction().
The PHP_CodeSniffer @codingStandardsIgnore annotations are deprecated
and, since version 3.x, the new // phpcs:ignore comments should be used
instead.
This commits just reviews all the uses in core, replacing them for
the better new candidate, or removing when no longer needed.
moodle_read_slave_trait: when creating another handle, restore temptables
property that is clobbered by raw_connect().
Also a better condition for temptable related queries detection in
pgsql_native_moodle_database.
dml_pgsql_read_slave_test::test_temp_table(): use real db connection
if possible, otherwise skip the test.
Implemented with moodle_read_slave_trait
Functionality is triggered by supplying config dboption['readonly'].
See config-dist.php for more info on supported dboptions.
pgsql and mysqli drivers are using this feature. Also added support for
connection timeout for these two drivers.