Commit graph

10768 commits

Author SHA1 Message Date
unknown
64f02f7db4 Merge gni@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb-bj
into  dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.0/bug29851


sql/ha_ndbcluster.cc:
  Auto merged
2008-01-09 11:17:50 +08:00
unknown
bafa5fe8aa BUG#29851 TRUNCATE causes error 4350 from cluster in INSERT... ON DUPLICATE KEY UPDATE
mysql-test/r/ndb_alter_table2.result:
  Add test case for BUG#29851
mysql-test/t/ndb_alter_table2.test:
  Add test case for BUG#29851
sql/ha_ndbcluster.cc:
  Indexes are dropped also when dropping table in GlobalDictCache
2007-09-28 09:16:41 +08:00
unknown
7ea03f33bd Merge dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/mysql-5.0-ndb
into  dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/mysql-5.0-ndb-bj.merge


sql/ha_ndbcluster.cc:
  Auto merged
2007-08-16 11:06:41 +08:00
unknown
9b460fb47c Merge lzhou@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb-bj
into  dev3-63.(none):/home/zhl/mysql/mysql-5.0/bug29674
2007-08-15 16:28:27 +00:00
unknown
b76fd3ed3b Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb


sql/ha_ndbcluster.cc:
  Auto merged
2007-08-14 15:34:04 +02:00
unknown
6656d39c72 Backport Magnus' fix from 5.1
ChangeSet@1.2575, 2007-08-07 19:16:06+02:00, msvensson@pilot.(none) +2 -0
  Bug#26793 mysqld crashes when doing specific query on information_schema
   - Drop the newly created user user1@localhost
   - Cleanup testcase


mysql-test/r/ndb_bug26793.result:
    mysql-test/r/ndb_bug26793.result@1.3, 2007-08-07 19:16:04+02:00, msvensson@pilot.(none)
  +1 -6
      Update test result
mysql-test/t/ndb_bug26793.test:
    mysql-test/t/ndb_bug26793.test@1.3, 2007-08-07 19:16:04+02:00, msvensson@pilot.(none) +8
  -11
      - Remove the drop/restore of anonymous users - there are no such users
      by default anymore(if there were, they would probably be in mysql.user)
      - Switch back to default connection before cleanup 
      - Drop user1@localhost as part of cleanup
2007-08-14 15:07:17 +10:00
unknown
a40202e696 bug#30337 DELETE ... WHERE PK IN (..) and AFTER DELETE trigger crashes API node: Added testcase 2007-08-13 15:59:08 +02:00
unknown
4c23e5f373 BUG#29674 Restore/backup are endian compatible in 5.0
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Twiddle the "replicaCount" and "fragCount" variable when restore data from different endian.
ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Add byte order variable
ndb/tools/restore/Restore.cpp:
  Twiddle blob, datatime,timestamp when do restore in different endian.
mysql-test/r/ndb_restore_different_endian_data.result:
  Test case result for restore data from different endian
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.1.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.2.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.log:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.log:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.1.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.2.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.log:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.log:
  Test case data
mysql-test/t/ndb_restore_different_endian_data.test:
  Test case for restore data from different endian
2007-08-07 18:07:57 +00:00
unknown
180068ddce save the data from mysql.db that we delete (side effect that made read_only fail) 2007-07-27 17:12:53 +10:00
unknown
b50015f280 [PATCH] BUG#26793 test: mysqld crashes in NDB on I_S query
Reduce case and formalise into something we should be
able to use in mysql-test-run.

Index: ndb-work/mysql-test/t/ndb_bug26793.test
===================================================================


mysql-test/r/ndb_bug26793.result:
  BUG#26793 test: mysqld crashes in NDB on I_S query
mysql-test/t/ndb_bug26793.test:
  BUG#26793 test: mysqld crashes in NDB on I_S query
2007-07-26 20:24:54 +10:00
unknown
c982517540 correct test and result 2007-06-17 22:04:01 +02:00
unknown
1f2c0193f4 Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
2007-06-17 19:50:07 +02:00
unknown
f2c7b62a3e BUG#27640
- correct test and result file
2007-06-17 19:27:20 +02:00
unknown
a3c2ebbcdd Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb
2007-06-14 21:58:45 +02:00
unknown
ebcbfef85f Bug #27640 backup id not displayed in the output of "ndb_mgm start backup wait completed"
- correction, missing node id
2007-06-14 18:40:32 +02:00
unknown
0d07520206 Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb
2007-06-14 16:21:52 +02:00
unknown
edb853a63b Merge jhe@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/bug27640-5.0-ndb


ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
2007-06-14 20:45:12 +08:00
unknown
4daad4ebfe Bug#27640, backup id not displayed in the output of "ndb_mgm start backup wait completed"
ndb/include/debugger/EventLogger.hpp:
  add definition for new printLogEvent() function in CommandInterpreter.cpp
ndb/src/mgmclient/CommandInterpreter.cpp:
  add a printLogEvent() function to print log event;
  filter "<PING>" by ndb_logevent_get_next() in event_thread_run();
  filter "<PING>" by ndb_logevent_get_next() in executeStartBackup();
  and make executeStartBackup() same in both 5.0 and 5.1
ndb/src/mgmclient/Makefile.am:
  add link to use ndb_logevent_get_next()
mysql-test/r/ndb_backup_print.result:
  testcase result for ndb_backup_print
  produced by mysql_test_run.pl
mysql-test/t/ndb_backup_print.test:
  add testcase for ndb_mgm -e "start backup", check outupt format
2007-06-14 19:40:44 +08:00
unknown
8046747c62 Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb


sql/handler.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Merge
2007-05-28 15:23:28 +02:00
unknown
b1a5f427bc Bug #28719: multi pk update ignore corrupts data
- check multi update as well as update
- this bug is not present in 5.0, but execution patch is wrong, so there are probably other bugs


mysql-test/r/ndb_basic.result:
  Bug #28719: multi pk update ignore corrupts data
  - add test + backport some tests from 5.1
mysql-test/t/ndb_basic.test:
  Bug #28719: multi pk update ignore corrupts data
  - add test + backport some tests from 5.1
2007-05-28 13:23:11 +02:00
unknown
adef673652 Merge mysql.com:/home/svoj/devel/bk/mysql-5.0
into  mysql.com:/home/svoj/devel/mysql/merge/mysql-5.0-engines
2007-05-23 12:39:33 +05:00
unknown
f529d18ba6 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
2007-05-22 23:20:40 +02:00
unknown
221e23ad72 Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/50
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/50


configure.in:
  Auto merged
mysql-test/r/strict.result:
  Auto merged
mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/t/type_datetime.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
2007-05-21 20:50:08 +02:00
unknown
66dc33eed2 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
2007-05-21 08:49:49 +02:00
unknown
f40047df9c Merge pilot.blaudden:/home/msvensson/mysql/bug28401/my50-bug28401
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
2007-05-19 18:22:08 +02:00
unknown
f52f931f4b Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
- The SQL commands used by mysql_upgrade are written to be run
    with sql_mode set to '' - thus the scripts should change sql_mode
    for the session to make sure the SQL is legal.


mysql-test/r/mysql_upgrade.result:
  Update test result
mysql-test/t/mysql_upgrade.test:
  The SQL commands used by mysql_upgrade are written to be run
  with sql_mode set to '' - thus the scripts should change sql_mode
  for the session to make sure the SQL is legal.
scripts/mysql_system_tables_fix.sql:
  Set sql_mode to '' before running the SQL commands
  to fix system tables - backport from 5.1
2007-05-19 18:15:08 +02:00
unknown
8933c18cca Merge bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0


mysql-test/r/ps.result:
  Auto merged
mysql-test/t/ps.test:
  Auto merged
sql/item.cc:
  Auto merged
2007-05-18 18:22:38 +02:00
unknown
f7434c4f93 added cleanup to some tests
mysql-test/r/sp_trans.result:
  added cleanup
mysql-test/r/strict.result:
  added cleanup
mysql-test/t/sp_trans.test:
  added cleanup
mysql-test/t/strict.test:
  added cleanup
2007-05-18 17:48:44 +02:00
unknown
ca633f5f56 Merge bk-internal:/home/bk/mysql-5.0-maint
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
2007-05-18 12:58:28 +02:00
unknown
f35dd61497 Merge pilot.blaudden:/home/msvensson/mysql/mysql-4.1-maint
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint


client/mysqltest.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/mysqltest.result:
  Auto merged
mysql-test/t/mysqltest.test:
  SCCS merged
2007-05-18 12:56:52 +02:00
unknown
421d8ca972 WL#2247 mysqltest: add option for sorting results
- Final touchups


client/mysqltest.c:
  Final touch ups, rename sorted_results to sorted_result
mysql-test/r/mysqltest.result:
  Update test result
mysql-test/t/mysqltest.test:
  Update results with additional subtests for empty result set,
  NULL values and 1024 rows
2007-05-18 12:50:23 +02:00
unknown
507ad360d7 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/28261-bug-5.0-opt-mysql
2007-05-18 13:39:34 +04:00
unknown
042b1717c4 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug28337
2007-05-17 16:06:57 -07:00
unknown
ce5f0d1bc3 Merge siva.hindu.god:/home/tsmith/m/bk/50
into  siva.hindu.god:/home/tsmith/m/bk/maint/50


mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/t/outfile.test:
  Auto merged
mysql-test/t/type_datetime.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/my_decimal.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
2007-05-17 14:17:50 -06:00
unknown
c4a4df5aa4 Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
is involved.

The Arg_comparator::compare_datetime() comparator caches its arguments if
they are constants i.e. const_item() returns true. The
Item_func_get_user_var::const_item() returns true or false based on
the current query_id and the query_id where the variable was created.
Thus even if a query can change its value its const_item() still will return
true. All this leads to a wrong comparison result when an object of the
Item_func_get_user_var class is involved.

Now the Arg_comparator::can_compare_as_dates() and the
get_datetime_value() functions never cache result of the GET_USER_VAR()
function (the Item_func_get_user_var class).


mysql-test/t/type_datetime.test:
  A test case is added for the bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
  is involved.
mysql-test/r/type_datetime.result:
  A test case is added for the bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
  is involved.
sql/item_cmpfunc.cc:
  Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
  is involved.
  Now the Arg_comparator::can_compare_as_dates() and the
  get_datetime_value() functions never cache result of the GET_USER_VAR()
  function (the Item_func_get_user_var class).
2007-05-17 23:09:45 +04:00
unknown
db18dc9da0 ps_6bdb.result:
Fix bad merge of test results


mysql-test/r/ps_6bdb.result:
  Fix bad merge of test results
2007-05-17 12:55:59 -06:00
unknown
dd1a118000 Fixed bug #28337: wrong results for grouping queries with correlated
subqueries in WHERE conditions.
This bug was introduced by the patch for bug 27321.


mysql-test/r/subselect.result:
  Added a test case for bug #28337.
mysql-test/t/subselect.test:
  Added a test case for bug #28337.
sql/item.cc:
  Fixed bug #28337: wrong results for grouping queries with correlated
  subqueries in WHERE conditions.
  This bug was introduced by the patch for bug 27321.
  
  Now in the Item_field::fix_outer_field function we create an Item_outer_ref
  object for an outer reference only if it is used in the SELECT list or
  in the HAVING clause of the subquery against which the reference is resolved.
2007-05-16 23:42:10 -07:00
unknown
b015146e41 Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/hf/work/8663/my50-8663
2007-05-17 00:10:39 +05:00
unknown
5e00d4b7f6 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/8663/my50-8663
2007-05-17 00:09:43 +05:00
unknown
614135222f WL#2247 mysqltest: add option for sorting results
- Change from "query_sorted <query>" to "sorted_results"


client/mysqltest.c:
  Replace "query_sorted <query>" with the ability to turn
  on "one shot result sorting" with the command "sorted_results"
mysql-test/r/mysqltest.result:
  Update test and result
mysql-test/t/mysqltest.test:
  Update test and result
2007-05-16 17:19:36 +02:00
unknown
7c70011e21 Merge kpettersson@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  adventure.(none):/home/thek/Development/cpp/mysql-5.0-runtime
2007-05-16 14:54:47 +02:00
unknown
d9ce3033f5 Bug#27415 Text Variables in stored procedures
- Problem was reported as a SP variable using itself as 
   right value inside SUBSTR caused corruption of data. 
 - This bug could not be verified in either 5.0bk or 5.1bk
 - Added test case to prevent future regressions.


mysql-test/r/sp-vars.result:
  Added test case for a reported regression which couldn't be
  verified.
mysql-test/t/sp-vars.test:
  Added test case for a reported regression which couldn't be
  verified.
2007-05-16 14:25:38 +02:00
unknown
8ab53d5f4e Bug#21103: "DATE column not compared as DATE"
BDB results fixed (not p/o 5.1 fix)


mysql-test/r/ps_6bdb.result:
  Now we get a note when we insert a datetime value into a date column
2007-05-16 14:00:47 +02:00
unknown
9e30e54837 Merge pilot.blaudden:/home/msvensson/mysql/bk_fix/mysql-5.0-maint-patch4
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
2007-05-16 12:49:15 +02:00
unknown
418a2983c0 Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/5.0o-bug27573


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  bug#27573: hand merged test case
2007-05-16 12:22:20 +03:00
unknown
b5e4f54a53 Backport of TIME->MYSQL_TIME / Y2K fixset
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
 


include/my_time.h:
  Removed not used define YY_MAGIC_BELOW
  Added prototype for year_2000_handling()
mysql-test/r/date_formats.result:
  Updated results (fixed bug in date_format() with year < 99
mysql-test/r/func_sapdb.result:
  Added more testing of make_date()
mysql-test/r/ps_2myisam.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_3innodb.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_4heap.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_5merge.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_7ndb.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/strict.result:
  zero-year in str_to_date() throws warning in strict
mysql-test/r/type_date.result:
  Added test for date conversions
mysql-test/r/type_datetime.result:
  Added testcase for datetime to date conversion.
mysql-test/t/date_formats.test:
  Added testing of dates < 200
mysql-test/t/func_sapdb.test:
  More testing of makedate()
mysql-test/t/type_date.test:
  Added test for date conversions
mysql-test/t/type_datetime.test:
  Added testcase for datetime to date conversion
sql/field.cc:
  Give note if we insert a datetime value in a date field
  Don't give notes if we are doing internal test conversions (like from convert_constant_item())
  More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
  Revert some changes in Field_newdate::store() to get more optimal code
  Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
  New parameters to make_truncated_value_warning()
sql/field.h:
  Give note if we insert a datetime value in a date field
  Don't give notes if we are doing internal test conversions (like from convert_constant_item())
  More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
  Revert some changes in Field_newdate::store() to get more optimal code
  Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
  New parameters to make_truncated_value_warning()
sql/item.cc:
  Give note if we insert a datetime value in a date field
  Don't give notes if we are doing internal test conversions (like from convert_constant_item())
  More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
  Revert some changes in Field_newdate::store() to get more optimal code
  Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
  New parameters to make_truncated_value_warning()
sql/item.h:
  TIME -> MYSQL_TIME
sql/item_cmpfunc.cc:
  Don't print notes in convert_constant_item()
sql/item_func.h:
  TIME -> MYSQL_TIME
sql/item_timefunc.cc:
  New parameters to make_truncated_value_warning()
  Moved year 2000 handling out from calc_days()
sql/item_timefunc.h:
  TIME -> MYSQL_TIME
sql/my_decimal.cc:
  TIME -> MYSQL_TIME
sql/my_decimal.h:
  TIME -> MYSQL_TIME
sql/mysql_priv.h:
  Added error level to make_truncated_value_warning()
sql/protocol.cc:
  TIME -> MYSQL_TIME
sql/protocol.h:
  TIME -> MYSQL_TIME
sql/sp.cc:
  TIME -> MYSQL_TIME
sql/sql_base.cc:
  Make testing of result value of save_in_field() uniform
sql/sql_class.h:
  TIME -> MYSQL_TIME
sql/sql_show.cc:
  TIME -> MYSQL_TIME
sql/structs.h:
  TIME -> MYSQL_TIME
sql/time.cc:
  Added error level to make_truncated_value_warning()
sql/tztime.cc:
  TIME -> MYSQL_TIME
sql/tztime.h:
  TIME -> MYSQL_TIME
sql/unireg.cc:
  For default values to CREATE, don't give errors for warning level NOTE
  (Fixed failed CREATE when we give a datetime value to a date field)
sql-common/my_time.c:
  Added year_2000_handling()
  Removed year 2000 handling from calc_daynr()
2007-05-16 10:44:59 +02:00
unknown
e675d25771 Bug#28223: mysqldump --compact --routines restores from @OLD_SQL_MODE w/o ever setting it
- mysqldump generated output that set OLD_SQL_MODE twice, to different values
    (for triggers), or not at all (for routines) in some cases.


client/mysqldump.c:
  Only save SQL_MODE in dump_triggers if in --compact mode. Otherwise,
  it's already been saved in write_header(). Likewise for dumpe_routines,
  where it was never saved.
mysql-test/r/mysqldump.result:
  mysqldump output has subtly changed. Adjust test-results. This also shows
  OLD_SQL_MODE is always set exactly once now
2007-05-16 10:14:29 +02:00
unknown
7e628372e9 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  vajra.(none):/opt/local/work/mysql-5.0-21483


sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
2007-05-16 09:52:01 +04:00
unknown
3395c53efc A fix and a test case for
Bug#21483 "Server abort or deadlock on INSERT DELAYED with another
implicit insert"
Also fixes and adds test cases for bugs:
20497 "Trigger with INSERT DELAYED causes Error 1165"
21714 "Wrong NEW.value and server abort on INSERT DELAYED to a
table with a trigger".
Post-review fixes.

Problem:
In MySQL INSERT DELAYED is a way to pipe all inserts into a
given table through a dedicated thread. This is necessary for
simplistic storage engines like MyISAM, which do not have internal
concurrency control or threading and thus can not
achieve efficient INSERT throughput without support from SQL layer.
DELAYED INSERT works as follows:
For every distinct table, which can accept DELAYED inserts and has
pending data to insert, a dedicated thread is created to write data
to disk. All user connection threads that attempt to
delayed-insert into this table interact with the dedicated thread in
producer/consumer fashion: all records to-be inserted are pushed
into a queue of the dedicated thread, which fetches the records and 
writes them.
In this design, client connection threads never open or lock
the delayed insert table.
This functionality was introduced in version 3.23 and does not take 
into account existence of triggers, views, or pre-locking.
E.g. if INSERT DELAYED is called from a stored function, which,
in turn, is called from another stored function that uses the delayed
table, a deadlock can occur, because delayed locking by-passes
pre-locking. Besides:
 * the delayed thread works directly with the subject table through
   the storage engine API and does not invoke triggers
 * even if it was patched to invoke triggers, if triggers,
   in turn, used other tables, the delayed thread would
   have to open and lock involved tables (use pre-locking).
 * even if it was patched to use pre-locking, without deadlock
   detection the delayed thread could easily lock out user 
   connection threads in case when the same table is used both
   in a trigger and on the right side of the insert query: 
   the delayed thread would not release locks until all inserts 
   are complete, and user connection can not complete inserts 
   without having locks on the tables used on the right side of the
   query.

Solution:

These considerations suggest two general alternatives for the
future of INSERT DELAYED:
 * it is considered a full-fledged alternative to normal INSERT
 * it is regarded as an optimisation that is only relevant 
   for simplistic engines.
Since we missed our chance to provide complete support of new
features when 5.0 was in development, the first alternative
currently renders infeasible.
However, even the second alternative, which is to detect
new features and convert DELAYED insert into a normal insert, 
is not easy to implement.
The catch-22 is that we don't know if the subject table has triggers
or is a view before we open it, and we only open it in the
delayed thread. We don't know if the query involves pre-locking
until we have opened all tables, and we always first create
the delayed thread, and only then open the remaining tables.
This patch detects the problematic scenarios and converts
DELAYED INSERT to a normal INSERT using the following approach:
 * if the statement is executed under pre-locking (e.g. from
   within a stored function or trigger) or the right
   side may require pre-locking, we detect the situation
   before creating a delayed insert thread and convert the statement
   to a conventional INSERT.
  * if the subject table is a view or has triggers, we shutdown
   the delayed thread and convert the statement to a conventional
   INSERT.


mysql-test/r/insert.result:
  Update test results.
mysql-test/t/insert.test:
  Add a test case for Bug#21483, Bug#20497, Bug#21714 (INSERT DELAYED
  and stored routines, triggers).
sql/sp_head.cc:
  Upgrade lock type to TL_WRITE when computing the pre-locking set.
sql/sql_base.cc:
  Use a new method.
sql/sql_insert.cc:
  INSERT DELAYED and pre-locking:
  - if  under pre-locking, upgrade the lock type to TL_WRITE
  and proceed as a normal write
  - if DELAYED table has triggers, also request a lock upgrade.
  - make sure errors in the delayed thread are propagated
  correctly
sql/sql_lex.h:
  Add a method to check if a parsed tree refers to stored
  routines.
2007-05-16 09:51:05 +04:00
unknown
1e33cfb36a bug #8663 cant use bigint unsigned as input to cast
in the case of the overflow in the decimal->integer conversion
we didn't return the proper boundary value, but just the result
of the conversion we calculated on the moment of the error


mysql-test/r/bigint.result:
  bug #8663 cant use bigint unsigned as input to cast
  test result fixed
mysql-test/t/bigint.test:
  bug #8663 cant use bigint unsigned as input to cast
  test case
strings/decimal.c:
  bug #8663 cant use bigint unsigned as input to cast
  decimal->int conversion fixed to return proper boundary value
  in the case of overflow
2007-05-16 10:12:49 +05:00