summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-02-08 12:53:31 +0200
committerunknown <heikki@hundin.mysql.fi>2004-02-08 12:53:31 +0200
commitb0076aad731e2e2ea12c5261e0b89c27c5e34f2f (patch)
tree6e3837457d2aa459de0f45d419f33f1f0ae85a8c /sql/ha_innodb.cc
parent496cbfe8a9b65e2f77530fff849b98368d6cc47b (diff)
downloadmariadb-git-b0076aad731e2e2ea12c5261e0b89c27c5e34f2f.tar.gz
ha_innodb.cc:
If AUTOCOMMIT=1, then we do not need to make a plain SELECT set shared locks even on the SERIALIZABLE isolation level, because we know the transaction is read-only: a read-only transaction can always be performed on the REPEATABLE READ level, and that does not endanger the serializability sql/ha_innodb.cc: If AUTOCOMMIT=1, then we do not need to make a plain SELECT set shared locks even on the SERIALIZABLE isolation level, because we know the transaction is read-only: a read-only transaction can always be performed on the REPEATABLE READ level, and that does not endanger the serializability
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 68052014f57..01af07f34ec 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -539,7 +539,7 @@ innobase_query_caching_of_table_permitted(
if (thd->variables.tx_isolation == ISO_SERIALIZABLE) {
/* In the SERIALIZABLE mode we add LOCK IN SHARE MODE to every
- plain SELECT */
+ plain SELECT if AUTOCOMMIT is not on. */
return((my_bool)FALSE);
}
@@ -4483,11 +4483,17 @@ ha_innobase::external_lock(
}
if (trx->isolation_level == TRX_ISO_SERIALIZABLE
- && prebuilt->select_lock_type == LOCK_NONE) {
+ && prebuilt->select_lock_type == LOCK_NONE
+ && (thd->options
+ & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
- /* To get serializable execution we let InnoDB
+ /* To get serializable execution, we let InnoDB
conceptually add 'LOCK IN SHARE MODE' to all SELECTs
- which otherwise would have been consistent reads */
+ which otherwise would have been consistent reads. An
+ exception is consistent reads in the AUTOCOMMIT=1 mode:
+ we know that they are read-only transactions, and they
+ can be serialized also if performed as consistent
+ reads. */
prebuilt->select_lock_type = LOCK_S;
}