|
|||||||||||
|
Re: bk commit - 6.0-falcon tree (istruewing:1.2563) BUG#26827
From: Sergei Golubchik <serg(at)mysql.com>
Date: Fri Jun 22 2007 - 03:40:14 EDT
On Jun 22, Ingo Strüwing wrote:
I'd prefer it to be done wherever we saw a first duplicate key error, in sql_update.cc. If possible. Another optimization - you only need to clone if the main handler will need to continue the scan - that is, if it's UPDATE IGNORE. Normally update is aborted on the first error, so there's no need to preserve the cursor. > Why do we need that clone at all? When we take position() and do No. > Is the cursor disturbed by it? Yes, it may be. A cursor may be more than a position. For example, if it's an index scan, in MyISAM the cursor includes lastkey value. In NDB the scan is done on all nodes asynchronously. The cursor includes the current position on every node. > The importance of the question is made by the fact that we need to do In this case you don't need to clone at all. As I wrote above "in any case all the above can be skipped if the necessary bit is already set". That is, partition handler needs the complete record, so it sets all bits in read_set. On the duplicate key, MySQL checks the read_set and notices that the field it needs for the error message is present in the record image, so it can generate an error message right away. Re-reading the row (with rnd_pos) is only necessary if a field is missing in read_set. And a clone is only necessary if we want to continue the scan after issuing the error message (UPDATE IGNORE). Multi-table update, by the way, is often resolved via temporary table, all positions are stored there, then MySQL does rnd_pos only. In this case there's no cursor to preserve, so even in UPDATE IGNORE case we don't need to clone.
Regards / Mit vielen Grüssen,
-- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Sergei GolubchikReceived on Fri Jun 22 03:53:57 2007 This archive was generated by hypermail 2.1.8 : Fri Jun 22 2007 - 04:00:02 EDT |
||||||||||
|
|||||||||||