Bug #40505 | INSERT DELAYED and transactions, duplicate keys | ||
---|---|---|---|
Submitted: | 4 Nov 2008 16:09 | Modified: | 21 Nov 2008 10:31 |
Reporter: | Vladimir Kolesnikov | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: General | Severity: | S4 (Feature request) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[4 Nov 2008 16:09]
Vladimir Kolesnikov
[5 Nov 2008 8:14]
Sergei Golubchik
the behavior is, basically, intentional. There's a lot of non-determinism in INSERT DELAYED (a simplest one - you can never know what you will see if you SELECT shortly after INSERT DELAYED). As for HA_EXTRA_IGNORE_DUP_KEY - try INSERT DELAYED IGNORE. As for "why insert-delayed-handler opens a long transaction" - for example, in certain engines it may be faster to insert rows in batches instead of committing every single write_row(). But I do agree that committing every now and then sounds useful. I could turn this into a feature request "INSERT DELAYED should commit periodically", okay ? Don't yet know how often, a config variable @@delayed_commits ? or at the end of every INSERT DELAYED statement ?
[5 Nov 2008 9:45]
Vladimir Kolesnikov
Making a separate transaction for every INSERT would be in my understanding the only valid option for a transactional engine. Otherwise as I said - one can get random number of valid statements rolled back together with invalid ones. Provided that one of primary INSERT DELAYED usages is logging this can be also a severe security problem. OTOH for non-trx engines this would slow down the operation, so maybe it makes sense to add separate logics for trx engines, and keep existing code for non-trx.
[21 Nov 2008 10:31]
Sveta Smirnova
Thank you for the feedback. Verified as feature request.