summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-09-30 20:20:10 +0200
committerunknown <serg@serg.mylan>2005-09-30 20:20:10 +0200
commit8f842e8fc9f304e4f95d81df3c222bab11ced391 (patch)
treeb141dda4cc321d6df0ee276762ac7bdbfa33b17c /sql
parent60ee93262bb7412c6f592b9b3152fbf3035a2037 (diff)
downloadmariadb-git-8f842e8fc9f304e4f95d81df3c222bab11ced391.tar.gz
Bug#11238
"SELECT ... FOR UPDATE executed as consistent read inside LOCK TABLES" Do not discard lock_type information as handler::start_stmt() may require knowledge. (fixed by Antony)
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_berkeley.cc2
-rw-r--r--sql/ha_berkeley.h2
-rw-r--r--sql/ha_innodb.cc5
-rw-r--r--sql/ha_innodb.h2
-rw-r--r--sql/ha_ndbcluster.cc2
-rw-r--r--sql/ha_ndbcluster.h2
-rw-r--r--sql/handler.h2
-rw-r--r--sql/sql_base.cc2
8 files changed, 10 insertions, 9 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 2f47b03de9d..a4c91c72368 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1894,7 +1894,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
Under LOCK TABLES, each used tables will force a call to start_stmt.
*/
-int ha_berkeley::start_stmt(THD *thd)
+int ha_berkeley::start_stmt(THD *thd, thr_lock_type lock_type)
{
int error=0;
DBUG_ENTER("ha_berkeley::start_stmt");
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index 282641e3f25..f291fd7a668 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -124,7 +124,7 @@ class ha_berkeley: public handler
int extra(enum ha_extra_function operation);
int reset(void);
int external_lock(THD *thd, int lock_type);
- int start_stmt(THD *thd);
+ int start_stmt(THD *thd, thr_lock_type lock_type);
void position(byte *record);
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index de458785534..b6737b3a991 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -6000,7 +6000,8 @@ int
ha_innobase::start_stmt(
/*====================*/
/* out: 0 or error code */
- THD* thd) /* in: handle to the user thread */
+ THD* thd, /* in: handle to the user thread */
+ thr_lock_type lock_type)
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
@@ -6041,7 +6042,7 @@ ha_innobase::start_stmt(
} else {
if (trx->isolation_level != TRX_ISO_SERIALIZABLE
&& thd->lex->sql_command == SQLCOM_SELECT
- && thd->lex->lock_option == TL_READ) {
+ && lock_type == TL_READ) {
/* For other than temporary tables, we obtain
no lock for consistent read (plain SELECT). */
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index d3c7af432a0..0c2b6d0f71a 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -150,7 +150,7 @@ class ha_innobase: public handler
int extra(enum ha_extra_function operation);
int external_lock(THD *thd, int lock_type);
int transactional_table_lock(THD *thd, int lock_type);
- int start_stmt(THD *thd);
+ int start_stmt(THD *thd, thr_lock_type lock_type);
void position(byte *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 709a7ed14e0..e22f0ecfbc2 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -3400,7 +3400,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
startTransaction for each transaction/statement.
*/
-int ha_ndbcluster::start_stmt(THD *thd)
+int ha_ndbcluster::start_stmt(THD *thd, thr_lock_type lock_type)
{
int error=0;
DBUG_ENTER("start_stmt");
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 2a1d51724d4..4bda78cf234 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -501,7 +501,7 @@ class ha_ndbcluster: public handler
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
int external_lock(THD *thd, int lock_type);
- int start_stmt(THD *thd);
+ int start_stmt(THD *thd, thr_lock_type lock_type);
const char * table_type() const;
const char ** bas_ext() const;
ulong table_flags(void) const;
diff --git a/sql/handler.h b/sql/handler.h
index f4f6a8592bb..c3a61d696f7 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -647,7 +647,7 @@ public:
virtual int reset() { return extra(HA_EXTRA_RESET); }
virtual int external_lock(THD *thd, int lock_type) { return 0; }
virtual void unlock_row() {}
- virtual int start_stmt(THD *thd) {return 0;}
+ virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;}
/*
This is called to delete all rows in a table
If the handler don't support this, then this function will
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index bb14d22e493..7352940ee69 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2148,7 +2148,7 @@ static bool check_lock_and_start_stmt(THD *thd, TABLE *table,
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),table->alias);
DBUG_RETURN(1);
}
- if ((error=table->file->start_stmt(thd)))
+ if ((error=table->file->start_stmt(thd, lock_type)))
{
table->file->print_error(error,MYF(0));
DBUG_RETURN(1);