Hi, Sergei Here is a version that reuses used logic when one searches and updates the same index. The principal impact is that we can't use the can_compare optimization because we have to store all new values for all keys of tempfile. But this correct a bug in my previous implementation (on update through a view). This simplifies the code a bit, but not much (no needs of tempfile_key). I don't see how to do this more simpler. If you have better ideas, I listen your suggestions. Thank you very much. Jérôme.
-----Message d'origine----- De : Sergei Golubchik [mailto:serg@mariadb.org] Envoyé : vendredi 18 août 2017 01:24 À : jerome brauge Cc : maria-developers@lists.launchpad.net; Alexander Barkov Objet : Re: Patch for MDEV-12874 - UPDATE statements with the same source and target
Hi, jerome!
On Jul 21, jerome brauge wrote:
Hello,
Here is a patch for MDEV-12874 (on branch 10.2-ext). Can anyone review it ?
I'll send comments about the code later, don't want to mix small details and the big question. So, the big one:
Why did you introduce completely new code for handling updates with the same table? mysql_update has logic when one searches and updates the same index (UPDATE idx=idx*2 WHERE idx > 5). That's used_key_is_modified variable. I'd thought you could reuse that. You might still need your tempfile_newdata, but even then it'll be much less code and simpler implementation. Would that work?
Regards, Sergei Chief Architect MariaDB and security@mariadb.org