Use cache as long as a trx only performes reads

As before, the cache will be used if there is no ongoing transaction
(includes autocommit being on), or if there is an explicitly read-
only transaction.

In addition, the cache will be used and populated during any other
transaction as long as only pure read statements are executed. After
first non-read statement, the use of the cache is disabled.
This commit is contained in:
Johan Wikman
2017-02-28 14:46:57 +02:00
parent f1ea0b03d1
commit 82049b8ed1
4 changed files with 75 additions and 14 deletions

View File

@ -26,9 +26,18 @@ Currently there is **no** cache invalidation, apart from _time-to-live_.
Resultsets of prepared statements are **not** cached.
### Transactions
The cache will be used and populated **only** if there is _no_ on-going
transaction or if an on-going transaction is _explicitly_ read-only (that is,
`START TRANSACTION READ ONLY`).
The cache will be used and populated in the following circumstances:
* There is _no_ on-going transaction, that is, _autocommit_ is used,
* there is an _explicitly_ read-only transaction (that is,`START TRANSACTION
READ ONLY`) active, or
* there is a transaction active and _no_ statement that modify the database
has been performed.
In practice, the last bullet point basically means that if a transaction has
been started with `BEGIN` or `START TRANSACTION READ WRITE`, then the cache
will be used and populated until the first `UPDATE`, `INSERT` or `DELETE`
statement is encountered.
### Variables
The cache key is effectively the entire _SELECT_ statement. However, the

View File

@ -8,6 +8,14 @@ release 2.1.0.
For any problems you encounter, please consider submitting a bug
report at [Jira](https://jira.mariadb.org).
## Changed Features
### Cache
The cache will now _also_ be used and populated in a transaction that is
_not_ explicitly read only, but only until the first statement that modifies
the database is encountered.
## Dropped Features
### MaxAdmin