Here is minimal patch but:
1) partition tables have to be checked
2) the function should be used videly (maybe not for efficiency)
=== modified file 'sql/handler.cc'
— sql/handler.cc 2014-04-11 08:46:11 +0000
+++ sql/handler.cc 2014-04-25 07:23:04 +0000
@@ -5285,6 +5285,10 @@ void signal_log_not_needed(struct handle
DBUG_VOID_RETURN;
}
+void handler::ha_set_lock_type(enum thr_lock_type lock)
+
{
+ table->reginfo.lock_type= lock;
+}
#ifdef TRANS_LOG_MGM_EXAMPLE_CODE
/*
=== modified file 'sql/handler.h'
— sql/handler.h 2014-04-11 08:46:11 +0000
+++ sql/handler.h 2014-04-25 07:23:18 +0000
@@ -2952,6 +2952,8 @@ class handler :public Sql_alloc
inline int ha_write_tmp_row(uchar *buf);
inline int ha_update_tmp_row(const uchar * old_data, uchar * new_data);
+ virtual void ha_set_lock_type(enum thr_lock_type lock);
+
friend enum icp_result handler_index_cond_check(void* h_arg);
};
=== modified file 'sql/sql_update.cc'
— sql/sql_update.cc 2014-03-17 12:04:28 +0000
+++ sql/sql_update.cc 2014-04-25 07:20:39 +0000
@@ -1304,7 +1304,7 @@ int mysql_multi_update_prepare(THD *thd)
tl->updating= 0;
/* Update TABLE::lock_type accordingly. */
if (!tl->placeholder() && !using_lock_tables)
- tl->table->reginfo.lock_type= tl->lock_type;
+ tl->table->file->ha_set_lock_type(tl->lock_type);
}
}
for (tl= table_list; tl; tl= tl->next_local)
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
— storage/myisammrg/ha_myisammrg.cc 2013-12-13 12:00:38 +0000
+++ storage/myisammrg/ha_myisammrg.cc 2014-04-25 07:29:43 +0000
@@ -1713,6 +1713,24 @@ my_bool ha_myisammrg::register_query_cac
DBUG_RETURN(FALSE);
}
+
+void ha_myisammrg::ha_set_lock_type(enum thr_lock_type lock)
+{
+ table->reginfo.lock_type= lock;
+ if (children_l != NULL)
+ {
+ for (TABLE_LIST *child_table= children_l;;
+ child_table= child_table->next_global)
+
{
+ child_table->lock_type=
+ child_table->table->reginfo.lock_type= lock;
+
+ if (&child_table->next_global == children_last_l)
+ break;
+ }
+ }
+}
+
extern int myrg_panic(enum ha_panic_function flag);
int myisammrg_panic(handlerton *hton, ha_panic_function flag)
{
=== modified file 'storage/myisammrg/ha_myisammrg.h'
--- storage/myisammrg/ha_myisammrg.h 2012-07-13 19:17:32 +0000
+++ storage/myisammrg/ha_myisammrg.h 2014-04-25 07:13:33 +0000
@@ -155,4 +155,5 @@ class ha_myisammrg: public handler
Query_cache *cache,
Query_cache_block_table **block,
uint *n);
+ virtual void ha_set_lock_type(enum thr_lock_type lock);
}
;
The problem here is that MySQL 5.5 did cause problems in how privileges are checked in multi-table-update.
We are fixing this and several other multi-table-update problems as part of
MDEV-5981name resolution issues with views and multi-update in ps-protocol.This should be fixed at the same time or after this task is done.