Hi!
On Jul 08, eugene@stripped wrote:
> ChangeSet@stripped, 2007-07-08 00:17:35+04:00, evgen@stripped +4 -0
> Bug#29310: An InnoDB table was updated when the data wasn't actually changed.
>
> When a table is being updated it has two set of fields - fields required for
> checks of conditions and fields to be updated. A storage engine is allowed
> not to retrieve columns marked for update. Due to this fact records can't
> be compared to see whether the data has been changed or not. This makes the
> server always update records independently of data change.
>
> Now when server sees that a handle isn't going to retrieve write-only fields
> then all of such fields are marked as to be read to force the handler to
> retrieve them.
>
> diff -Nrup a/sql/sql_update.cc b/sql/sql_update.cc
> --- a/sql/sql_update.cc 2007-06-28 17:07:54 +04:00
> +++ b/sql/sql_update.cc 2007-07-08 00:16:29 +04:00
> @@ -231,6 +231,13 @@ int mysql_update(THD *thd,
> if (cond_value == Item::COND_FALSE)
> limit= 0; // Impossible WHERE
> }
> +
> + /*
> + Force handler to retrieve write-only fields to be able to compare
> + records and detect data change.
> + */
> + if (table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ)
> + bitmap_union(table->read_set, table->write_set);
> // Don't count on usage of 'only index' when calculating which key to use
> table->covering_keys.clear_all();
Arhg, no!
I told you on irc, retrieving more columns than necessary is expensive.
We do NOT want to do it unconditionally.
Please fix your patch to do bitmap_union() only when there's an
ON UPDATE CURRENT_TIMESTAMP field.
Regards / Mit vielen Grüssen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
/_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Radlkoferstr. 2, D-81373 München
<___/ Geschäftsführer: Kaj Arnö - HRB
München 162140