summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
Commit message (Collapse)AuthorAgeFilesLines
* Manual merge from mysql-trunk-merge.Alexander Nozdrin2009-11-051-4/+4
|\
| * Bug #40877: multi statement execution fails in 5.1.30Georgi Kodinov2009-10-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented the server infrastructure for the fix: 1. Added a function LEX_STRING *thd_query_string(THD) to return a LEX_STRING structure instead of char *. This is the function that must be called in innodb instead of thd_query() 2. Did some encapsulation in THD : aggregated thd_query and thd_query_length into a LEX_STRING and made accessor and mutator methods for easy code updating. 3. Updated the server code to use the new methods where applicable.
* | Manual merge from mysql-trunk-merge.Alexander Nozdrin2009-10-141-61/+87
|\ \ | |/
| * Bug#46958: Assertion in Diagnostics_area::set_ok_status, Martin Hansson2009-09-281-61/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trigger, merge table The problem with break statements is that they have very local effects. Hence a break statement within the inner loop of a nested-loops join caused execution to proceed to the next table even though a serious error occurred. The problem was fixed by breaking out the inner loop into its own method. The change empowers all errors to terminate the execution. The errors that will now halt multi-DELETE execution altogether are - triggers returning errors - handler errors - server being killed
* | WL#4444 Added TRUNCATE partition support, fixes bug#19405 and bug #35111Mikael Ronstrom2009-09-101-2/+17
|/
* Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROPRamil Kalimullin2009-08-211-0/+4
| | | | | | | | | | | | (temporary) TABLE, crash Problem: if one has an open "HANDLER t1", further "TRUNCATE t1" doesn't close the handler and leaves handler table hash in an inconsistent state, that may lead to a server crash. Fix: TRUNCATE should implicitly close all open handlers. Doc. request: the fact should be described in the manual accordingly.
* Merge of the fix for bug #40113 to 5.1.Georgi Kodinov2009-07-131-1/+9
|\
| * Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout Georgi Kodinov2009-07-131-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | without error When using quick access methods for searching rows in UPDATE or DELETE there was no check if a fatal error was not already sent to the client while evaluating the quick condition. As a result a false OK (following the error) was sent to the client and the error was thus transformed into a warning. Fixed by checking for errors sent to the client during SQL_SELECT::check_quick() and treating them as real errors. Fixed a wrong test case in group_min_max.test Fixed a wrong return code in mysql_update() and mysql_delete()
* | Bug#44834 strxnmov is expected to behave as you'd expectSergey Glukhov2009-06-191-2/+2
| | | | | | | | | | | | | | | | The problem: described in the bug report. The fix: --increase buffers where it's necessary (buffers which are used in stxnmov) --decrease buffer lengths which are used
* | auto-merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteamAlfranio Correia2009-06-181-1/+1
|\ \
| * | BUG#43929 binlog corruption when max_binlog_cache_size is exceededAlfranio Correia2009-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Large transactions and statements may corrupt the binary log if the size of the cache, which is set by the max_binlog_cache_size, is not enough to store the the changes. In a nutshell, to fix the bug, we save the position of the next character in the cache before starting processing a statement. If there is a problem, we simply restore the position thus removing any effect of the statement from the cache. Unfortunately, to avoid corrupting the binary log, we may end up loosing changes on non-transactional tables if they do not fit in the cache. In such cases, we store an Incident_log_event in order to stop the slave and alert users that some changes were not logged. Precisely, for every non-transactional changes that do not fit into the cache, we do the following: a) the statement is *not* logged b) an incident event is logged after committing/rolling back the transaction, if any. Note that if a failure happens before writing the incident event to the binary log, the slave will not stop and the master will not have reported any error. c) its respective statement gives an error For transactional changes that do not fit into the cache, we do the following: a) the statement is *not* logged b) its respective statement gives an error To work properly, this patch requires two additional things. Firstly, callers to MYSQL_BIN_LOG::write and THD::binlog_query must handle any error returned and take the appropriate actions such as undoing the effects of a statement. We already changed some calls in the sql_insert.cc, sql_update.cc and sql_insert.cc modules but the remaining calls spread all over the code should be handled in BUG#37148. Secondly, statements must be either classified as DDL or DML because DDLs that do not get into the cache must generate an incident event since they cannot be rolled back.
| | |
| \ \
*-. \ \ Merge from 5.0-bugteamStaale Smedseng2009-06-171-1/+1
|\ \ \ \ | |_|/ / |/| | / | | |/
| | * Bug #43414 Parenthesis (and other) warnings compiling MySQL Staale Smedseng2009-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with gcc 4.3.2 Compiling MySQL with gcc 4.3.2 and later produces a number of warnings, many of which are new with the recent compiler versions. This bug will be resolved in more than one patch to limit the size of changesets. This is the second patch, fixing more of the warnings.
| * | Bug #43414 Parenthesis (and other) warnings compiling MySQL Staale Smedseng2009-06-101-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | with gcc 4.3.2 Compiling MySQL with gcc 4.3.2 and later produces a number of warnings, many of which are new with the recent compiler versions. This bug will be resolved in more than one patch to limit the size of changesets. This is the second patch, fixing more of the warnings.
| * merged 5.0-main -> 5.0-bugteamGeorgi Kodinov2009-05-151-7/+7
| |\
| | * Merge community up to enterprise, thus ending the community-serverChad MILLER2009-05-061-7/+7
| | |\ | | | | | | | | | | | | adventure.
| | | * Merged from 5.0 (enterprise).Chad MILLER2008-12-171-2/+2
| | | |\
| | | * \ Merge from 5.0 trunk.Chad MILLER2008-07-141-2/+2
| | | |\ \
| | | * \ \ Merge chunk from trunk.Chad MILLER2008-07-101-9/+10
| | | |\ \ \
| | | * \ \ \ Merge bk-internal.mysql.com:/home/bk/mysql-5.0cmiller@zippy.cornsilk.net2007-12-101-7/+7
| | | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
| | | | * \ \ \ Merge bk-internal.mysql.com:/home/bk/mysql-5.0cmiller@zippy.cornsilk.net2007-09-101-7/+7
| | | | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
| | | | | * \ \ \ Merge mysqldev@production.mysql.com:my/mysql-5.0-releasecmiller@zippy.cornsilk.net2007-07-021-7/+7
| | | | | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
| | | | | | * \ \ \ Merge mysqldev@production.mysql.com:my/mysql-5.0-releasecmiller@zippy.cornsilk.net2007-04-261-7/+7
| | | | | | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
* | | | | | | | | | | BUG#41948 Query_log_event constructor needlessly contortedHe Zhenxing2009-05-301-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the caller of Query_log_event, Execute_load_log_event constructors and THD::binlog_query to provide the error code instead of having the constructors to figure out the error code.
* | | | | | | | | | | merging with local fix.Anurag Shekhar2009-05-061-1/+19
|\ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / /
| * | | | | | | | | | Bug #39918 memory (heap) engine crashing with b-tree index and DELETE Anurag Shekhar2009-05-061-1/+19
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with seg fault Multiple-table DELETE from a table joined to itself may cause server crash. This was originally discovered with MEMORY engine, but may affect other engines with different symptoms. The problem was that the server violated SE API by performing parallel table scan in one handler and removing records in another (delete on the fly optimization).
| * | | | | | | | | BUG#37145 Killing a statement doing DDL may log binlog event with error code ↵He Zhenxing2009-03-271-2/+2
| | |_|_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1053 When the thread executing a DDL was killed after finished its execution but before writing the binlog event, the error code in the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED. This patch fixed the problem by ignoring the kill status when constructing the event for DDL statements. This patch also included the following changes in order to provide the test case. 1) modified mysqltest to support variable for connection command 2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to run mysql client against the slave mysqld.
* | | | | | | | | Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violationKristofer Pettersson2009-03-271-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on 5.0 The server crashes on an assert in net_end_statement indicating that the Diagnostics area wasn't set properly during execution. This happened on a multi table DELETE operation using the IGNORE keyword. The keyword is suppose to allow for execution to continue on a best effort despite some non-fatal errors. Instead execution stopped and no client response was sent which would have led to a protocol error if it hadn't been for the assert. This patch corrects this issue by checking for the existence of an IGNORE option before setting an error state during row-by-row delete iteration.
* | | | | | | | | Merging with 5.1-bugteam.Mats Kindahl2009-02-091-0/+3
|\ \ \ \ \ \ \ \ \
| * | | | | | | | | BUG#35583 mysqlbinlog replay fails with ERROR 1146 when temp tables are usedAlfranio Correia2009-01-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using CREATE TEMPORARY TABLE LIKE to create a temporary table, or using TRUNCATE to delete all rows of a temporary table, they did not set the tmp_table_used flag, and cause the omission of "SET @@session.pseudo_thread_id" when dumping binlog with mysqlbinlog, and cause error when replay the statements. This patch fixed the problem by setting tmp_table_used in these two cases. (Done by He Zhenxing 2009-01-12)
* | | | | | | | | | Bug #36763Mats Kindahl2009-02-061-2/+20
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TRUNCATE TABLE fails to replicate when stmt-based binlogging is not supported. There were two separate problems with the code, both of which are fixed with this patch: 1. An error was printed by InnoDB for TRUNCATE TABLE in statement mode when the in isolation levels READ COMMITTED and READ UNCOMMITTED since InnoDB does permit statement-based replication for DML statements. However, the TRUNCATE TABLE is not transactional, but is a DDL, and should therefore be allowed to be replicated as a statement. 2. The statement was not logged in mixed mode because of the error above, but the error was not reported to the client. This patch fixes the problem by treating TRUNCATE TABLE a DDL, that is, it is always logged as a statement and not reporting an error from InnoDB for TRUNCATE TABLE.
* | | | | | | | | Bug#37016: TRUNCATE TABLE removes some rows but not allDavi Arnaut2009-01-091-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The special TRUNCATE TABLE (DDL) transaction wasn't being properly rolled back if a error occurred during row by row deletion. The error can be caused by a foreign key restriction imposed by InnoDB SE and would cause the server to erroneously issue a implicit commit. The solution is to rollback the transaction if a truncation via row by row deletion fails, otherwise commit. All effects of a TRUNCATE ABLE operation are rolled back if a row by row deletion fails.
* | | | | | | | | Bug#29507 TRUNCATE shows to many rows effectedKristofer Pettersson2008-11-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TRUNCATE TABLE for InnoDB tables returned a count showing an approximation of the number of rows affected to gain efficiency. Now the statement always returns 0 rows affected for clarity.
* | | | | | | | | Merge fix for BUG#35478 into 5.1Sergey Petrunia2008-07-151-2/+2
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / /
| * | | | | | | | BUG#35478: sort_union() returns bad data when sort_buffer_size is hitSergey Petrunia2008-07-151-2/+2
| | |_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In QUICK_INDEX_MERGE_SELECT::read_keys_and_merge: when we got table->sort from Unique, tell init_read_record() not to use rr_from_cache() because a) rowids are already sorted and b) it might be that the the data is used by filesort(), which will need record rowids (which rr_from_cache() cannot provide). - Fully de-initialize the table->sort read in QUICK_INDEX_MERGE_SELECT::get_next(). This fixes BUG#35477. (bk trigger: file as fix for BUG#35478).
| * | | | | | | Merge host.loc:/home/uchum/work/mysql-5.0gshchepa/uchum@host.loc2008-03-271-2/+2
| |\ \ \ \ \ \ \ | | |_|_|_|_|_|/ | |/| | | | | | | | | | | | | | into host.loc:/home/uchum/work/5.0-opt
| * | | | | | | Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0anozdrin/alik@quad.opbmk2008-03-251-5/+10
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
* | \ \ \ \ \ \ \ Merge host.loc:/home/uchum/work/mysql-5.1gshchepa/uchum@host.loc2008-03-271-2/+2
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into host.loc:/home/uchum/work/5.1-opt
| * \ \ \ \ \ \ \ \ Merge magare.gmz:/home/kgeorge/mysql/autopush/B26461-5.0-optgkodinov/kgeorge@magare.gmz2008-03-211-2/+2
| |\ \ \ \ \ \ \ \ \ | | | |_|/ / / / / / | | |/| | | | | | | | | | | | | | | | | into magare.gmz:/home/kgeorge/mysql/work/B26461-5.1-opt
| | * | | | | | | | Bug #26461: Intrinsic data type bool (1 byte) redefined to BOOL (4 bytes)gkodinov/kgeorge@macbook.gmz2008-03-211-2/+2
| | | |_|/ / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bool data type was redefined to BOOL (4 bytes on windows). Removed the #define and fixed some of the warnings that were uncovered by this. Note that the fix also disables 2 warnings : 4800 : 'type' : forcing value to bool 'true' or 'false' (performance warning) 4805: 'operation' : unsafe mix of type 'type' and type 'type' in operation These warnings will be handled in a separate bug, as they are performance related or bogus. Fixed to int the return type of functions that return more than 2 distinct values.
* | | | | | | | | Merge stella.local:/home2/mydev/mysql-5.1-amainistruewing@stella.local2008-03-261-0/+13
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into stella.local:/home2/mydev/mysql-5.1-axmrg
| * \ \ \ \ \ \ \ \ Merge stella.local:/home2/mydev/mysql-5.1-ateamistruewing@stella.local2008-03-261-0/+13
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into stella.local:/home2/mydev/mysql-5.1-axmrg
| | * | | | | | | | | BUG#34768 - nondeterministic INSERT using LIMIT logged in stmt mode ifsvoj@mysql.com/june.mysql.com2008-03-181-0/+13
| | |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | binlog_format=mixed Statement-based replication of DELETE ... LIMIT, UPDATE ... LIMIT, INSERT ... SELECT ... LIMIT is not safe as order of rows is not defined. With this fix, we issue a warning that this statement is not safe to replicate in statement mode, or go to row-based mode in mixed mode. Note that we may consider a statement as safe if ORDER BY primary_key is present. However it may confuse users to see very similiar statements replicated differently. Note 2: regular UPDATE statement (w/o LIMIT) is unsafe as well, but this patch doesn't address this issue. See comment from Kristian posted 18 Mar 10:55.
* | | | | | | | | | Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1anozdrin/alik@quad.opbmk2008-03-251-3/+11
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | | | | | | | | | | | | into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
| * | | | | | | | | Fix manual merge.anozdrin/alik@quad.2008-03-121-7/+9
| | | | | | | | | |
| * | | | | | | | | Fix manual merge.anozdrin/alik@quad.2008-03-121-3/+3
| | | | | | | | | |
| * | | | | | | | | Merge quad.:/mnt/raid/alik/MySQL/devel/5.0-rtanozdrin/alik@quad.2008-03-121-6/+12
| |\ \ \ \ \ \ \ \ \ | | |/ / / / / / / / | |/| | | / / / / / | | | |_|/ / / / / | | |/| | | | | | into quad.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
| | * | | | | | | A fix for Bug#34643: TRUNCATE crash if trigger and foreign key.anozdrin/alik@quad.2008-03-121-5/+10
| | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In cases when TRUNCATE was executed by invoking mysql_delete() rather than by table recreation (for example, when TRUNCATE was issued on InnoDB table with is referenced by foreign key) triggers were invoked. In debug builds this also led to crash because of an assertion, which assumes that some preliminary actions take place before trigger invocation, which doesn't happen in case of TRUNCATE. The fix is not to execute triggers in mysql_delete() when this function is used by TRUNCATE.
* | | | | | | | Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1mkindahl@dl145h.mysql.com2008-03-051-4/+0
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | | | | | | | | | into dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl
| * | | | | | | Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rplmkindahl@dl145h.mysql.com2008-02-151-4/+0
| |\ \ \ \ \ \ \ | | | |/ / / / / | | |/| | | | | | | | | | | | | into dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl