Below is the list of changes that have just been committed into a local
5.0 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2205 06/07/04 11:43:06 tomas@stripped +3 -0
Bug #20784 Uninitialized memory in update on table with PK not on first column
- partial backport of code from 5.1, do cot compare_record for engines that do not read
all columns during update
sql/sql_update.cc
1.191 06/07/04 11:42:52 tomas@stripped +22 -3
Bug #20784 Uninitialized memory in update on table with PK not on first column
- partial backport of code from 5.1, do cot compare_record for engines that do not
read all columns during update
sql/handler.h
1.172 06/07/04 11:42:52 tomas@stripped +1 -0
Bug #20784 Uninitialized memory in update on table with PK not on first column
- partial backport of code from 5.1, do cot compare_record for engines that do not
read all columns during update
sql/ha_ndbcluster.cc
1.267 06/07/04 11:42:52 tomas@stripped +2 -1
Bug #20784 Uninitialized memory in update on table with PK not on first column
- partial backport of code from 5.1, do cot compare_record for engines that do not
read all columns during update
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/mysql-5.0
--- 1.171/sql/handler.h 2006-06-02 09:02:48 +02:00
+++ 1.172/sql/handler.h 2006-07-04 11:42:52 +02:00
@@ -57,6 +57,7 @@
see mi_rsame/heap_rsame/myrg_rsame
*/
#define HA_READ_RND_SAME (1 << 0)
+#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
#define HA_REC_NOT_IN_SEQ (1 << 3) /* ha_info don't return recnumber;
It returns a position to ha_r_rnd */
--- 1.190/sql/sql_update.cc 2006-06-19 14:50:46 +02:00
+++ 1.191/sql/sql_update.cc 2006-07-04 11:42:52 +02:00
@@ -120,6 +120,7 @@
bool using_limit= limit != HA_POS_ERROR;
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table;
+ bool can_compare_record;
int res;
int error;
uint used_index= MAX_KEY;
@@ -433,6 +434,13 @@
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)));
+ /*
+ We can use compare_record() to optimize away updates if
+ the table handler is returning all columns
+ */
+ can_compare_record= !(table->file->table_flags() &
+ HA_PARTIAL_COLUMN_READ);
+
while (!(error=info.read_record(&info)) && !thd->killed)
{
if (!(select && select->skip_record()))
@@ -445,7 +453,7 @@
found++;
- if (compare_record(table, query_id))
+ if (!can_compare_record || compare_record(table, query_id))
{
if ((res= table_list->view_check_option(thd, ignore)) !=
VIEW_CHECK_OK)
@@ -1248,8 +1256,15 @@
uint offset= cur_table->shared;
table->file->position(table->record[0]);
+ /*
+ We can use compare_record() to optimize away updates if
+ the table handler is returning all columns
+ */
if (table == table_to_update)
{
+ bool can_compare_record;
+ can_compare_record= !(table->file->table_flags() &
+ HA_PARTIAL_COLUMN_READ);
table->status|= STATUS_UPDATED;
store_record(table,record[1]);
if (fill_record_n_invoke_before_triggers(thd, *fields_for_table[offset],
@@ -1259,7 +1274,7 @@
DBUG_RETURN(1);
found++;
- if (compare_record(table, thd->query_id))
+ if (!can_compare_record || compare_record(table, thd->query_id))
{
int error;
if ((error= cur_table->view_check_option(thd, ignore)) !=
@@ -1376,6 +1391,7 @@
for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local)
{
byte *ref_pos;
+ bool can_compare_record;
table = cur_table->table;
if (table == table_to_update)
@@ -1402,6 +1418,9 @@
if ((local_error = tmp_table->file->ha_rnd_init(1)))
goto err;
+ can_compare_record= !(table->file->table_flags() &
+ HA_PARTIAL_COLUMN_READ);
+
ref_pos= (byte*) tmp_table->field[0]->ptr;
for (;;)
{
@@ -1431,7 +1450,7 @@
TRG_ACTION_BEFORE, TRUE))
goto err2;
- if (compare_record(table, thd->query_id))
+ if (!can_compare_record || compare_record(table, thd->query_id))
{
if ((local_error=table->file->update_row(table->record[1],
table->record[0])))
--- 1.266/sql/ha_ndbcluster.cc 2006-06-30 16:29:12 +02:00
+++ 1.267/sql/ha_ndbcluster.cc 2006-07-04 11:42:52 +02:00
@@ -4575,7 +4575,8 @@
HA_NO_PREFIX_CHAR_KEYS |
HA_NEED_READ_RANGE_BUFFER |
HA_CAN_GEOMETRY |
- HA_CAN_BIT_FIELD),
+ HA_CAN_BIT_FIELD |
+ HA_PARTIAL_COLUMN_READ),
m_share(0),
m_use_write(FALSE),
m_ignore_dup_key(FALSE),
| Thread |
|---|
| • bk commit into 5.0 tree (tomas:1.2205) BUG#20784 | tomas | 4 Jul |