Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can we disable REPLACE stmt in MySQL if SE can't support it ?

0 views
Skip to first unread message

Krunal Bauskar

unread,
Aug 11, 2008, 12:36:38 AM8/11/08
to
- Is there a way to disable REPLACE stmt if SE can't support it.
REPLACE internally is expanded as sequence of write, delete, update
row and so disabling directly at SE API level doesn't look feasible.

- I also couldn't trace any table flags for the same.

--
Regards,
Krunal Bauskar

--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe: http://lists.mysql.com/internals?unsub=mysql-i...@freebsd.csie.nctu.edu.tw

Sergei Golubchik

unread,
Aug 11, 2008, 3:25:18 AM8/11/08
to
Hi!

On Aug 11, Krunal Bauskar wrote:
> - Is there a way to disable REPLACE stmt if SE can't support it.
> REPLACE internally is expanded as sequence of write, delete, update
> row and so disabling directly at SE API level doesn't look feasible.

Yes, it does not.
Why you engine cannot support REPLACE if it's internally expanded as
sequence of write, delete, update row ?

Regards / Mit vielen Grüssen,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <se...@mysql.com>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring

Rick James

unread,
Aug 11, 2008, 7:55:51 AM8/11/08
to
If it is actually expanded outside the engine, is there an issue of it not being atomic? Seems like some other thread could slip in and change the data such that the last step(s) hit a conflict.


Rick James
MySQL Geeks - Consulting & Review

> http://lists.mysql.com/internals?unsub=rja...@yahoo-inc.com

Sergei Golubchik

unread,
Aug 11, 2008, 8:22:57 AM8/11/08
to
Hi!

On Aug 11, Rick James wrote:
> If it is actually expanded outside the engine, is there an issue of it
> not being atomic? Seems like some other thread could slip in and
> change the data such that the last step(s) hit a conflict.

There should not be. MySQL achieves it by locking the table it works on
with an exclusive lock. Similarly a client cannot see half of the update
or insert ... select.

If a storage engine decided to weaken the lock level, it can do that -
but in that case the engine becomes responsible for statement
isolation. Basically any engine that support page- or row-level locking
do that (weaken the lock level and enforce isolation internally).

An engine can also, if it so chooses, to weaken the lock level and NOT
to enforce the proper isolation - we cannot do anything against it.
It'll be a bug in the engine. Or a feature, in certain applications.
Anyway, in that case a race condition that you describe is possible.

Regards / Mit vielen Grüssen,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <se...@mysql.com>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring

--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals

To unsubscribe: http://lists.mysql.com/internals?unsub=mysql-i...@freebsd.csie.nctu.edu.tw

0 new messages