Commit graph

266 commits

Author SHA1 Message Date
Sergei Golubchik
4f67a14700 5.2->5.3 merge 2013-01-10 15:40:21 +01:00
Sergei Golubchik
bd87fed1dc 5.1 merge 2013-01-10 13:54:04 +01:00
Sergei Golubchik
2e11ca36f2 mysql-5.1.67 merge 2013-01-09 23:51:51 +01:00
Rohit Kalhans
7c671a7ead BUG#14548159: Followup patch to fix some issues on PB2 2012-09-23 15:45:22 +05:30
Rohit Kalhans
5530c5e38d BUG#14548159: NUMEROUS CASES OF INCORRECT IDENTIFIER
QUOTING IN REPLICATION 

Problem: Misquoting or unquoted identifiers may lead to
incorrect statements to be logged to the binary log.

Fix: we use specialized functions to append quoted identifiers in
the statements generated by the server.
2012-09-22 17:50:51 +05:30
unknown
fc666a0df6 merge from 5.2 2012-08-24 14:02:32 +02:00
unknown
96703a63da Merge from 5.1. 2012-08-24 12:32:46 +02:00
unknown
cdeabcfd43 MDEV-382: Incorrect quoting
Various places in the server replication code was incorrectly quoting
strings, which could lead to incorrect SQL on the slave/mysqlbinlog.
2012-08-24 10:06:16 +02:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Michael Widenius
6920457142 Merge with MariaDB 5.1 2011-11-24 18:48:58 +02:00
Michael Widenius
a8d03ab235 Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
2011-11-21 19:13:14 +02:00
Michael Widenius
22e793639a Added new options to KILL. New syntax is KILL [HARD|SOFT] [CONNECTION|QUERY] [ID | USER user_name]
- If USER is given, all threads for that user is signaled
- If SOFT is used then the KILL will not be sent to the handler. This can be used to not interrupt critical things in the handler like 'REPAIR'.

Internally added more kill signals. This gives us more information of why a query/connection was killed.
- KILL_SERVER is used when server is going down. In this case the users gets ER_SHUTDOWN as the reason connection was killed.
- Changed signals to number in correct order, which makes it easier to test how the signal should affect the code.
- New error message ER_CONNECTION_KILLED if connection was killed by 'KILL CONNECTION'. Before we got error ER_SHUTDOWN.

Changed names of not used parameters KILL_QUERY & KILL_CONNCTION to mysql_kill() to not conflict with defines in the server


include/mysql.h.pp:
  Updated file
include/mysql_com.h:
  Changed names of not used parameters KILL_QUERY & KILL_CONNCTION to mysql_kill() to not conflict with defines in the server
mysql-test/r/kill.result:
  Added test of KILL USER
mysql-test/suite/rpl/r/rpl_stm_000001.result:
  Updated error code
mysql-test/suite/rpl/t/rpl_stm_000001.test:
  Updated error codes
mysql-test/t/flush_read_lock_kill.test:
  Updated error codes
mysql-test/t/kill.test:
  Added test of KILL USER
plugin/handler_socket/handlersocket/database.cpp:
  Removed THD:: from KILL
sql/debug_sync.cc:
  Removed THD:: from KILL
sql/event_scheduler.cc:
  Removed THD:: from KILL
sql/filesort.cc:
  Removed THD:: from KILL
sql/ha_ndbcluster_binlog.cc:
  Removed THD:: from KILL
sql/handler.cc:
  Removed THD:: from KILL
  Simplify code.
sql/lex.h:
  Added new keywords HARD | SOFT
sql/log.cc:
  Removed THD:: from KILL
  Added testing of new error ER_CONNECTION_KILLED
sql/log_event.cc:
  Removed THD:: from KILL
  Added testing of new error ER_CONNECTION_KILLED
sql/mysql_priv.h:
  Added new prototypes
sql/mysqld.cc:
  Removed THD:: from KILL
  Use KILL_SERVER_HARD signal on shutdown.
sql/scheduler.cc:
  Removed THD:: from KILL
  Simplify test if connection should be killed
sql/share/errmsg.txt:
  New error message ER_CONNECTION_KILLED
sql/slave.cc:
  Removed THD:: from KILL
sql/sp_head.cc:
  Removed THD:: from KILL
sql/sql_base.cc:
  Removed THD:: from KILL
sql/sql_cache.cc:
  Removed THD:: from KILL
sql/sql_class.cc:
  Removed THD:: from KILL
  Added killed_errno()
  Only signal kill to storage engine if HARD bit is set.
sql/sql_class.h:
  Move KILL options out from THD to make them easier to use in sql_yacc.yy
sql/sql_connect.cc:
  Removed THD:: from KILL
sql/sql_delete.cc:
  Removed THD:: from KILL
sql/sql_error.cc:
  Removed THD:: from KILL
sql/sql_insert.cc:
  Removed THD:: from KILL
  Simplifed testing if thread is killed.
sql/sql_lex.h:
  Added kill options to st_lex
sql/sql_load.cc:
  Removed THD:: from KILL
sql/sql_parse.cc:
  Added kill options to st_lex
  Simplifed and optimzed testing of thd->killed at end of query
  Added support for KILL USER
  Extended sql_kill() to allow use of more kill signals.
sql/sql_repl.cc:
  Removed THD:: from KILL
sql/sql_show.cc:
  Removed THD:: from KILL
  Simplied testing if query/connection was killed
sql/sql_table.cc:
  Removed THD:: from KILL
sql/sql_update.cc:
  Removed THD:: from KILL
sql/sql_yacc.yy:
  Added support for new KILL syntax: KILL [HARD|SOFT] [CONNECTION|QUERY] [ID | USER user_name]
storage/archive/ha_archive.cc:
  Simplify compilation
storage/maria/ha_maria.cc:
  Removed THD:: from KILL
2011-09-23 01:13:38 +03:00
Kent Boortz
027b5f1ed4 Updated/added copyright headers 2011-07-03 17:47:37 +02:00
Guilhem Bichot
12c42b980a Fix for BUG#11755168 '46895: test "outfile_loaddata" fails (reproducible)'.
In sql_class.cc, 'row_count', of type 'ha_rows', was used as last argument for
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD which is
"Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld".
So 'ha_rows' was used as 'long'.
On SPARC32 Solaris builds, 'long' is 4 bytes and 'ha_rows' is 'longlong' i.e. 8 bytes.
So the printf-like code was reading only the first 4 bytes.
Because the CPU is big-endian, 1LL is 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
so the first four bytes yield 0. So the warning message had "row 0" instead of
"row 1" in test outfile_loaddata.test:
-Warning	1366	Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 1
+Warning	1366	Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 0

All error-messaging functions which internally invoke some printf-life function
are potential candidate for such mistakes.
One apparently easy way to catch such mistakes is to use
ATTRIBUTE_FORMAT (from my_attribute.h).
But this works only when call site has both:
a) the format as a string literal
b) the types of arguments.
So:
  func(ER(ER_BLAH), 10);
will silently not be checked, because ER(ER_BLAH) is not known at
compile time (it is known at run-time, and depends on the chosen
language).
And
  func("%s", a va_list argument);
has the same problem, as the *real* type of arguments is not
known at this site at compile time (it's known in some caller).
Moreover,
  func(ER(ER_BLAH));
though possibly correct (if ER(ER_BLAH) has no '%' markers), will not
compile (gcc says "error: format not a string literal and no format
arguments").

Consequences:
1) ATTRIBUTE_FORMAT is here added only to functions which in practice
take "string literal" formats: "my_error_reporter" and "print_admin_msg".
2) it cannot be added to the other functions: my_error(),
push_warning_printf(), Table_check_intact::report_error(),
general_log_print().

To do a one-time check of functions listed in (2), the following
"static code analysis" has been done:
1) replace
  my_error(ER_xxx, arguments for substitution in format)
with the equivalent
  my_printf_error(ER_xxx,ER(ER_xxx), arguments for substitution in
format),
so that we have ER(ER_xxx) and the arguments *in the same call site*
2) add ATTRIBUTE_FORMAT to push_warning_printf(),
Table_check_intact::report_error(), general_log_print()
3) replace ER(xxx) with the hard-coded English text found in
errmsg.txt (like: ER(ER_UNKNOWN_ERROR) is replaced with
"Unknown error"), so that a call site has the format as string literal
4) this way, ATTRIBUTE_FORMAT can effectively do its job
5) compile, fix errors detected by ATTRIBUTE_FORMAT
6) revert steps 1-2-3.
The present patch has no compiler error when submitted again to the
static code analysis above.
It cannot catch all problems though: see Field::set_warning(), in
which a call to push_warning_printf() has a variable error
(thus, not replacable by a string literal); I checked set_warning() calls
by hand though.

See also WL 5883 for one proposal to avoid such bugs from appearing
again in the future.

The issues fixed in the patch are:
a) mismatch in types (like 'int' passed to '%ld')
b) more arguments passed than specified in the format.
This patch resolves mismatches by changing the type/number of arguments,
not by changing error messages of sql/share/errmsg.txt. The latter would be wrong,
per the following old rule: errmsg.txt must be as stable as possible; no insertions
or deletions of messages, no changes of type or number of printf-like format specifiers,
are allowed, as long as the change impacts a message already released in a GA version.
If this rule is not followed:
- Connectors, which use error message numbers, will be confused (by insertions/deletions
of messages)
- using errmsg.sys of MySQL 5.1.n with mysqld of MySQL 5.1.(n+1)
could produce wrong messages or crash; such usage can easily happen if
installing 5.1.(n+1) while /etc/my.cnf still has --language=/path/to/5.1.n/xxx;
or if copying mysqld from 5.1.(n+1) into a 5.1.n installation.
When fixing b), I have verified that the superfluous arguments were not used in the format
in the first 5.1 GA (5.1.30 'bteam@astra04-20081114162938-z8mctjp6st27uobm').
Had they been used, then passing them today, even if the message doesn't use them
anymore, would have been necessary, as explained above.

include/my_getopt.h:
  this function pointer is used only with "string literal" formats, so we can add
  ATTRIBUTE_FORMAT.
mysql-test/collections/default.experimental:
  test should pass now
sql/derror.cc:
  by having a format as string literal, ATTRIBUTE_FORMAT check becomes effective.
sql/events.cc:
  Change justified by the following excerpt from sql/share/errmsg.txt:
  ER_EVENT_SAME_NAME
          eng "Same old and new event name"
  ER_EVENT_SET_VAR_ERROR
          eng "Error during starting/stopping of the scheduler. Error code %u"
sql/field.cc:
  ER_TOO_BIG_SCALE 42000 S1009
          eng "Too big scale %d specified for column '%-.192s'. Maximum is %lu."
  ER_TOO_BIG_PRECISION 42000 S1009
          eng "Too big precision %d specified for column '%-.192s'. Maximum is %lu."
  ER_TOO_BIG_DISPLAYWIDTH 42000 S1009
          eng "Display width out of range for column '%-.192s' (max = %lu)"
sql/ha_ndbcluster.cc:
  ER_OUTOFMEMORY HY001 S1001
          eng "Out of memory; restart server and try again (needed %d bytes)"
  (sizeof() returns size_t)
sql/ha_ndbcluster_binlog.cc:
  Too many arguments for:
  ER_GET_ERRMSG  
          eng "Got error %d '%-.100s' from %s"
  Patch by Jonas Oreland.
sql/ha_partition.cc:
  print_admin_msg() is used only with a literal as format, so ATTRIBUTE_FORMAT
  works.
sql/handler.cc:
  ER_OUTOFMEMORY HY001 S1001
          eng "Out of memory; restart server and try again (needed %d bytes)"
  (sizeof() returns size_t)
sql/item_create.cc:
  ER_TOO_BIG_SCALE 42000 S1009
          eng "Too big scale %d specified for column '%-.192s'. Maximum is %lu."
  ER_TOO_BIG_PRECISION 42000 S1009
          eng "Too big precision %d specified for column '%-.192s'. Maximum is %lu."
  'c_len' and 'c_dec' are char*, passed as %d !! We don't know their value
  (as strtoul() failed), but they are likely big, so we use INT_MAX.
  'len' is ulong.
sql/item_func.cc:
  ER_WARN_DATA_OUT_OF_RANGE 22003 
          eng "Out of range value for column '%s' at row %ld"
  ER_CANT_FIND_UDF  
          eng "Can't load function '%-.192s'"
sql/item_strfunc.cc:
  ER_TOO_BIG_FOR_UNCOMPRESS  
          eng "Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)"
  max_allowed_packet is ulong.
sql/mysql_priv.h:
  sql_print_message_func is a function _pointer_.
sql/sp_head.cc:
  ER_SP_RECURSION_LIMIT
          eng "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.192s"
  max_sp_recursion_depth is ulong
sql/sql_acl.cc:
  ER_PASSWORD_NO_MATCH 42000 
          eng "Can't find any matching row in the user table"
  ER_CANT_CREATE_USER_WITH_GRANT 42000
          eng "You are not allowed to create a user with GRANT"
sql/sql_base.cc:
  ER_NOT_KEYFILE  
          eng "Incorrect key file for table '%-.200s'; try to repair it"
  ER_TOO_MANY_TABLES  
          eng "Too many tables; MySQL can only use %d tables in a join"
  MAX_TABLES is size_t.
sql/sql_binlog.cc:
  ER_UNKNOWN_ERROR  
          eng "Unknown error"
sql/sql_class.cc:
  ER_TRUNCATED_WRONG_VALUE_FOR_FIELD  
          eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld"
  WARN_DATA_TRUNCATED 01000 
          eng "Data truncated for column '%s' at row %ld"
sql/sql_connect.cc:
  ER_HANDSHAKE_ERROR 08S01 
          eng "Bad handshake"
  ER_BAD_HOST_ERROR 08S01 
          eng "Can't get hostname for your address"
sql/sql_insert.cc:
  ER_WRONG_VALUE_COUNT_ON_ROW 21S01 
          eng "Column count doesn't match value count at row %ld"
sql/sql_parse.cc:
  ER_WARN_HOSTNAME_WONT_WORK  
          eng "MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work"
  ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
  	eng "Too high level of nesting for select"
  ER_UNKNOWN_ERROR  
          eng "Unknown error"
sql/sql_partition.cc:
  ER_OUTOFMEMORY HY001 S1001
          eng "Out of memory; restart server and try again (needed %d bytes)"
sql/sql_plugin.cc:
  ER_OUTOFMEMORY HY001 S1001
          eng "Out of memory; restart server and try again (needed %d bytes)"
sql/sql_prepare.cc:
  ER_OUTOFMEMORY HY001 S1001
          eng "Out of memory; restart server and try again (needed %d bytes)"
  ER_UNKNOWN_STMT_HANDLER  
          eng "Unknown prepared statement handler (%.*s) given to %s"
  length value (for '%.*s') must be 'int', per the doc of printf()
  and the code of my_vsnprintf().
sql/sql_show.cc:
  ER_OUTOFMEMORY HY001 S1001
          eng "Out of memory; restart server and try again (needed %d bytes)"
sql/sql_table.cc:
  ER_TOO_BIG_FIELDLENGTH 42000 S1009
          eng "Column length too big for column '%-.192s' (max = %lu); use BLOB or TEXT instead"
sql/table.cc:
  ER_NOT_FORM_FILE  
          eng "Incorrect information in file: '%-.200s'"
  ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE
          eng "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysql_upgrade to fix this error."
  table->s->mysql_version is ulong.
sql/unireg.cc:
  ER_TOO_LONG_TABLE_COMMENT
    eng "Comment for table '%-.64s' is too long (max = %lu)"
  ER_TOO_LONG_FIELD_COMMENT
    eng "Comment for field '%-.64s' is too long (max = %lu)"
  ER_TOO_BIG_ROWSIZE 42000 
          eng "Row size too large. The maximum row size for the used table type, not counting BLOBs, is %ld. You have to change some columns to TEXT or BLOBs"
2011-05-16 22:04:01 +02:00
Sergei Golubchik
291fd96983 pluggable auth with plugin examples
Makefile.am:
  add new API files to the check_abi rule,
  remove duplicates
client/CMakeLists.txt:
  now a client can use dlopen too
client/Makefile.am:
  be csh-friendly
include/my_global.h:
  add dummy plugs for dlopen and co.
  for the code that needs them to work in static builds
mysys/Makefile.am:
  be csh-friendly
plugin/auth/dialog.c:
  typo fixed
2010-03-29 17:13:53 +02:00
unknown
a962160eec Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.

This is a re-commit of Monty's merge to eliminate an extra commit from
MySQL-5.1.42 that was accidentally included in the merge.

This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
2009-11-16 21:49:51 +01:00
Georgi Kodinov
7b4ef910f7 Bug #40877: multi statement execution fails in 5.1.30
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.
2009-10-16 13:29:42 +03:00
Alexander Nozdrin
d499138770 A patch for Bug#47474 (mysqld hits Dbug_violation_helper assert
when compiled with Sun Studio compiler).

The thing is that Sun Studio compiler calls destructor of stack
objects when pthread_exit() is called. That triggered an assertion
in DBUG_ENTER()/DBUG_RETURN() validation logic (if DBUG_ENTER() is
used in the beginning of function, all returns should be replaced
by DBUG_RETURN/DBUG_VOID_RETURN macros).

A fix is to explicitly use DBUG_LEAVE macro.
2009-09-23 17:10:23 +04:00
Sergey Petrunya
29f0dcb563 Merge MySQL->MariaDB
* Finished Monty and Jani's merge
* Some InnoDB tests still fail (because it's old xtradb code run against
  newer testsuite). They are expected to go after mergning with the latest
  xtradb.
2009-09-08 00:50:10 +04:00
Davi Arnaut
439e1eb0e0 Backport Tomas Ulin fix for a spurious failure on PushBuild:
http://lists.mysql.com/commits/53569

sql/ha_ndbcluster_binlog.cc:
  Remove extraneous mutex lock which could cause the server to deadlock.
2009-08-01 18:24:20 -03:00
Gleb Shchepa
2bc6b6a800 Merge from 5.0
******
manual merge 5.0-bugteam --> 5.1-bugteam (bug 38816)
2009-07-24 21:04:55 +05:00
Sergey Glukhov
9347649c16 Bug#44834 strxnmov is expected to behave as you'd expect
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


client/mysql.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/ha_ndbcluster.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/ha_ndbcluster_binlog.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/handler.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/log.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/mysqld.cc:
  removed unnecessary line
sql/parse_file.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_acl.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_base.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_db.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_delete.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_partition.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_rename.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_show.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_table.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_view.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
2009-06-19 13:24:43 +05:00
He Zhenxing
abf5f8dac2 BUG#41948 Query_log_event constructor needlessly contorted
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.

sql/log_event.cc:
  Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
sql/log_event.h:
  Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
2009-05-30 21:32:28 +08:00
Michael Widenius
a8fdaa6f2c Merge with base MySQL 5.1
Contains fixes for test cases
Changed release tag to beta

configure.in:
  change release tag to beta
2009-02-15 12:58:34 +02:00
Michael Widenius
32f81bab7d WL#3262 add mutex lock order checking to safemutex (also called safe_mutex_deadlock_detector)
This writes a warning on stderr if one uses mutex in different order,
like if one in one case would lock mutex in the order A,B and in another case
would lock mutex in the order B,A
This is inspired by and loosely based on the LOCKDEP patch by Jonas
Wrong mutex order is either fixed or mutex are marked with MYF_NO_DEADLOCK_DETECTION
if used inconsistently (need to be fixed by server team)

KNOWN_BUGS.txt:
  Added information that one need to dump and restore Maria tables
include/hash.h:
  Added prototype function for walking over all elements in a hash
include/my_pthread.h:
  Added my_pthread_mutex_init() and my_pthread_mutex_lock(); These should be used if one wants to disable mutex order checking.
  Changed names of the nonposix mutex_init functions to not conflict with my_phread_mutex_init()
  Added and extended structures for mutex deadlock detection.
  New arguments to sage_mutex_init() and safe_mutex_lock() to allow one to disable mutex order checking.
  Added variable 'safe_mutex_deadlock_detector' to enable/disable deadlock detection for all pthread_mutex_init()
mysys/Makefile.am:
  Added cleaning of test files
  Added test_thr_mutex
mysys/hash.c:
  Added hash_iterate() to iterate over all elements in a hash
  More comments
mysys/my_init.c:
  Added calls to destory all mutex uses by mysys()
  Added waiting for threads to end before calling TERMINATE() to list not freed memory
mysys/my_pthread.c:
  Changed names to free my_pthread_mutex_init() for mutex-lock-order-checking
mysys/my_sleep.c:
  Fixed too long wait if using 1000000L as argument
mysys/my_thr_init.c:
  Mark THR_LOCK_threads and THR_LOCK_malloc to not have mutex deadlock detection.
  (We can't have it enabled for this as these are internal mutex used by the detector  
  Call my_thread_init() early as we need thread specific variables enabled for the following pthread_mutex_init()
  Move code to wait for threads to end to my_wait_for_other_threads_to_die()
  Don't destroy mutex and conditions unless all threads have died
  Added my_thread_destroy_mutex() to destroy all mutex used by the mysys thread system
  Name the thread specific mutex as "mysys_var->mutex"
  Added my_thread_var_mutex_in_use() to return pointer to mutex in use or 0 if thread variables are not initialized
mysys/mysys_priv.h:
  Added prototypes for functions used internally with mutex-wrong-usage detection
mysys/thr_mutex.c:
  Added runtime detection of mutex used in conflicting order
  See WL#3262 or test_thr_mutex.c for examples
  The base idea is for each mutex have two hashes:
  - mutex->locked_mutex points to all mutex used after this one
  - mutex->used_mutex points to all mutex which has this mutex in it's mutex->locked_mutex
  There is a wrong mutex order if any mutex currently locked before this mutex is in the mutex->locked_mutex hash
sql/event_queue.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/event_scheduler.cc:
  Declare the right order to take the mutex
sql/events.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/ha_ndbcluster_binlog.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/log.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/mysqld.cc:
  Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
  This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
  Added call to free sp cache.
  Add destruction of LOCK_server_started and COND_server_started.
  Added register_mutex_order() function to register in which order mutex should be taken
  (to initiailize mutex_deadlock_detector).
  Added option to turn off safe_mutex_deadlock_detector
sql/protocol.cc:
  Fixed wrong argument to DBUG_PRINT (found by valgrind)
sql/rpl_mi.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/set_var.cc:
  Remove wrong locking of LOCK_global_system_variables when reading and setting log variables
  (would cause inconsistent mutex order).
  Update global variables outside of logger.unlock() as LOCK_global_system_variables has to be taken before logger locks
  Reviewed by gluh
sql/sp_cache.cc:
  Added function to destroy mutex used by sp cache
sql/sp_cache.h:
  Added function to destroy mutex used by sp cache
sql/sql_class.cc:
  Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
  This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
  Register order in which LOCK_delete and mysys_var->mutex is taken
sql/sql_insert.cc:
  Give a name for Delayed_insert::mutex
  Mark mutex used inconsistently (need to be fixed by server team)
  Move closing of tables outside of di->mutex (to avoid wrong mutex order)
sql/sql_show.cc:
  Don't keep LOCK_global_system_variables locked over value->show_type() as this leads to wrong mutex order
storage/innobase/handler/ha_innodb.cc:
  Disable safe_muted_deadlock_detector for innobase intern mutex (to speed up page cache initialization)
storage/maria/ha_maria.cc:
  Added flag to ha_maria::info() to signal if we need to lock table share or not.
  This is needed to avoid locking mutex in wrong order
storage/maria/ha_maria.h:
  Added flag to ha_maria::info() to signal if we need to lock table share or not.
storage/maria/ma_close.c:
  Destroy key_del_lock
  Simplify freeing ftparser_param
storage/maria/ma_key.c:
  Better comment
storage/maria/ma_loghandler.c:
  Mark mutex used inconsistently (need to be fixed by sanja)
storage/maria/ma_state.c:
  More comments
storage/maria/ma_test1.c:
  Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
storage/maria/ma_test2.c:
  Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
2008-12-03 00:02:52 +02:00
unknown
11cb913b9a Bug#35943 Failure to create mysql.ndb_schema shoudl not be logged if tabe already exist
sql/ha_ndbcluster_binlog.cc:
  Add Ndb error code 721 to list of errors that should not be printed
  to error log
2008-04-09 18:42:05 +02:00
unknown
9cf8329833 Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rpl
into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr


client/mysqltest.c:
  Auto merged
configure.in:
  Auto merged
mysql-test/extra/rpl_tests/rpl_loaddata.test:
  Auto merged
mysql-test/extra/rpl_tests/rpl_log.test:
  Auto merged
mysql-test/include/mix1.inc:
  Auto merged
mysql-test/lib/mtr_report.pm:
  Auto merged
mysql-test/r/create.result:
  Auto merged
mysql-test/r/gis.result:
  Auto merged
mysql-test/r/mysqlbinlog.result:
  Auto merged
mysql-test/r/trigger.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Auto merged
mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
  Auto merged
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_flushlog_loop.result:
  Auto merged
mysql-test/suite/rpl/t/disabled.def:
  Auto merged
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
  Auto merged
mysql-test/t/create.test:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
mysql-test/t/show_check.test:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
mysql-test/mysql-test-run.pl:
  Use local
mysql-test/r/type_blob.result:
  Manual merge
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  Manual merge
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Manual merge
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Manual merge
mysql-test/suite/rpl/r/rpl_loaddata.result:
  Manual merge
mysql-test/t/mysqlbinlog2.test:
  Manual merge
2008-03-25 18:40:49 +01:00
unknown
5435b66b91 Fix after merge
mysql-test/extra/rpl_tests/rpl_charset.test:
  Fix merge error
mysql-test/lib/mtr_report.pm:
  Move the . out of [] to avoid log file parsing errors
mysql-test/mysql-test-run.pl:
  Correct spelling of option
sql/ha_ndbcluster_binlog.cc:
  Fix merge error(used "Use remote")
2008-02-28 18:55:46 +01:00
unknown
336f2c7e51 Merge quad.:/mnt/raid/alik/MySQL/devel/5.1
into  quad.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged


client/mysqltest.c:
  Auto merged
mysql-test/r/view.result:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_connect.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
mysql-test/suite/rpl_ndb/t/disabled.def:
  Manually merged.
mysql-test/t/disabled.def:
  Manually merged.
2008-02-26 19:34:02 +03:00
unknown
50ba314c98 Merge trift2.:/MySQL/M51/mysql-5.1
into  trift2.:/MySQL/M51/push-5.1


configure.in:
  Auto merged
extra/yassl/src/handshake.cpp:
  Auto merged
extra/yassl/src/template_instnt.cpp:
  Auto merged
extra/yassl/src/yassl_imp.cpp:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
storage/ndb/src/common/util/OutputStream.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp:
  Auto merged
storage/ndb/tools/waiter.cpp:
  Auto merged
2008-02-22 16:14:27 +01:00
unknown
9dfc925db0 Upon the sql command flush logs, we need to ensure that all outstanding
ndb data to be logged has made it to the binary log to get a deterministic
behavior on the rotation of the log.
2008-02-20 12:52:04 +01:00
unknown
ead02981ea Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  dipika.(none):/opt/local/work/mysql-5.1-2pc-opt-merge-push


mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Auto merged
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/suite/rpl_ndb/t/disabled.def:
  Manual merge.
2008-02-19 14:53:22 +03:00
unknown
526798dbb5 A fix and a test case for Bug#12713 "Error in a stored function called from
a SELECT doesn't cause ROLLBACK of statem".

The idea of the fix is to ensure that we always commit the current
statement at the end of dispatch_command(). In order to not issue
redundant disc syncs, an optimization of the two-phase commit
protocol is implemented to bypass the two phase commit if
the transaction is read-only.


mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Update test results.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  Update test results.
mysql-test/suite/rpl_ndb/t/disabled.def:
  Disable the tests, for which this changeset reveals a bug:
  the injector thread does not always add 'statement commit' to the
  rows injected in circular replication set up.
  To be investigated separately.
sql/ha_ndbcluster_binlog.cc:
  Add close_thread_tables() to run_query: this ensures
  that all tables are closed and there is no pending statement transaction.
sql/handler.cc:
  Implement optimisation of read-only transactions.
  If a transaction consists only of DML statements that do not change
  data, we do not perform a two-phase commit for it 
  (run one phase commit only).
sql/handler.h:
  Implement optimisation of read-only transactions.
  If a transaction consists only of DML statements that do not change
  data, we do not perform a two-phase commit for it 
  (run one phase commit only).
sql/log.cc:
  Mark the binlog transaction read-write whenever it's started.
  We never read from binlog, so it's safe and least intrusive to add
  this mark up here.
sql/log_event.cc:
  Update to the new layout of thd->transaction.
sql/rpl_injector.cc:
  Always commit statement transaction before committing the global one.
sql/sp.cc:
  Ad comments.
sql/sp_head.cc:
  Add comments.
sql/sql_base.cc:
  Commit transaction at the end of the statement. Always.
sql/sql_class.cc:
  Update thd_ha_data to return the right pointer in the new layout.
  
  Fix select_dumpvar::send_data to properly return operation status.
  A test case from commit.inc would lead to an assertion failure in the 
  diagnostics area (double assignment). Not test otherwise by the test suite.
sql/sql_class.h:
  Implement a new layout of storage engine transaction info in which 
  it is easy to access all members related to the handlerton only
  based on ht->slot.
sql/sql_cursor.cc:
  Update to the new layout of thd->transaction.
sql/sql_delete.cc:
  Remove wrong and now redundant calls to ha_autocommit_or_rollback.
  The transaction is committed in one place, at the end of the statement.
  Remove calls to mysql_unlock_tables, since some engines count locks
  and commit statement transaction in unlock_tables(), which essentially
  equates mysql_unlock_tables to ha_autocommit_or_rollback.
  Previously it was necessary to unlock tables soon because we wanted
  to avoid sending of 'ok' packet to the client under locked tables.
  This is no longer necessary, since OK packet is also sent from one place
  at the end of transaction.
sql/sql_do.cc:
  Add DO always clears the error, we must rollback the current
  statement before this happens. Otherwise the statement will be committed,
  and not rolled back in the end.
sql/sql_insert.cc:
  Remove wrong and now redundant calls to ha_autocommit_or_rollback.
  The transaction is committed in one place, at the end of the statement.
  Remove calls to mysql_unlock_tables, since some engines count locks
  and commit statement transaction in unlock_tables(), which essentially
  equates mysql_unlock_tables to ha_autocommit_or_rollback.
  Previously it was necessary to unlock tables soon because we wanted
  to avoid sending of 'ok' packet to the client under locked tables.
  This is no longer necessary, since OK packet is also sent from one place
  at the end of transaction.
sql/sql_load.cc:
  Remove wrong and now redundant calls to ha_autocommit_or_rollback.
  The transaction is committed in one place, at the end of the statement.
  Remove calls to mysql_unlock_tables, since some engines count locks
  and commit statement transaction in unlock_tables(), which essentially
  equates mysql_unlock_tables to ha_autocommit_or_rollback.
  Previously it was necessary to unlock tables soon because we wanted
  to avoid sending of 'ok' packet to the client under locked tables.
  This is no longer necessary, since OK packet is also sent from one place
  at the end of transaction.
sql/sql_parse.cc:
  Implement optimisation of read-only transactions: bypass 2-phase
  commit for them.
  Always commit statement transaction before commiting the global one.
  Fix an unrelated crash in check_table_access, when called from 
  information_schema.
sql/sql_partition.cc:
  Partitions commit at the end of a DDL operation.
  Make sure that send_ok() is done only if the commit has succeeded.
sql/sql_table.cc:
  Use ha_autocommit_or_rollback and end_active_trans everywhere.
  Add end_trans to mysql_admin_table, so that it leaves no pending
  transaction.
sql/sql_udf.cc:
  Remvove a redundant call to close_thread_tables()
sql/sql_update.cc:
  Remove wrong and now redundant calls to ha_autocommit_or_rollback.
  The transaction is committed in one place, at the end of the statement.
  Remove calls to mysql_unlock_tables, since some engines count locks
  and commit statement transaction in unlock_tables(), which essentially
  equates mysql_unlock_tables to ha_autocommit_or_rollback.
  Previously it was necessary to unlock tables soon because we wanted
  to avoid sending of 'ok' packet to the client under locked tables.
  This is no longer necessary, since OK packet is also sent from one place
  at the end of transaction.
mysql-test/include/commit.inc:
  New BitKeeper file ``mysql-test/include/commit.inc''
mysql-test/r/commit_1innodb.result:
  New BitKeeper file ``mysql-test/r/commit_1innodb.result''
mysql-test/t/commit_1innodb.test:
  New BitKeeper file ``mysql-test/t/commit_1innodb.test''
2008-02-19 14:43:01 +03:00
unknown
7335532a50 Merge pilot.mysql.com:/data/msvensson/mysql/bug19911/my51-bug19911
into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-build


sql/ha_ndbcluster_binlog.cc:
  Auto merged
2008-02-06 12:52:11 +01:00
unknown
66fa5cb968 Bug#19911 ndb does not work on sol10 x86
sql/ha_ndbcluster_binlog.cc:
  Change 'assert' to 'DBUG_ASSERT' to avoid that the assert is triggered in the optimized version
  on solaris 10 for x86
2008-02-06 11:44:07 +01:00
unknown
047ec78f2c Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge


mysql-test/include/have_multi_ndb.inc:
  Auto merged
mysql-test/lib/mtr_cases.pl:
  Auto merged
mysql-test/lib/mtr_report.pl:
  Auto merged
mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
  Auto merged
mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result:
  Auto merged
mysql-test/suite/rpl_ndb/t/disabled.def:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event_old.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/rpl_rli.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_binlog.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_string.cc:
  Auto merged
mysql-test/Makefile.am:
  SCCS merged
mysql-test/mysql-test-run.pl:
  Manual merge.
mysql-test/suite/binlog/t/disabled.def:
  Manual merge.
mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result:
  Manual merge.
mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result:
  Manual merge.
sql/log_event.cc:
  Manual merge.
  ,
2007-12-19 18:51:46 +01:00
unknown
7213ca204d Try to fix assertion failures at slave shutdown when running
rpl_ndb tests on sapsrv1.


sql/ha_ndbcluster_binlog.cc:
  Try to fix assertion failures at slave shutdown when running
  rpl_ndb tests. If the binlog thread is killed, which happens during
  shutdown, open_tables returns error without setting an error
  in THD. Therefore one can't access thd->main_da.message() if thd->killed.
2007-12-15 22:24:01 +03:00
unknown
cb48c979e5 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.(none):/opt/local/work/mysql-5.1-runtime


sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
2007-12-15 16:59:43 +03:00
unknown
65155892f0 NDB didn't like utf-8 in the last change for some reasons
Changing charset to latin1.
2007-12-14 20:11:49 +04:00
unknown
f989bb4f54 Merge mysql.com:/home/bar/mysql-work/mysql-5.1.b29562
into  mysql.com:/home/bar/mysql-work/mysql-5.1.b29562v2


mysql-test/suite/rpl_ndb/t/disabled.def:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
2007-12-14 13:41:36 +04:00
unknown
2c19aa1aa0 Merge mysql.com:/Users/davi/mysql/bugs/32395-5.1
into  mysql.com:/Users/davi/mysql/mysql-5.1-runtime


sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
2007-12-13 16:33:04 -02:00
unknown
e5a397e28f Bug#32395 Alter table under a impending global read lock causes a server crash
The problem is that some DDL statements (ALTER TABLE, CREATE
TRIGGER, FLUSH TABLES, ...) when under LOCK TABLES need to
momentarily drop the lock, reopen the table and grab the write
lock again (using reopen_tables). When grabbing the lock again,
reopen_tables doesn't pass a flag to mysql_lock_tables in
order to ignore the impending global read lock, which causes a
assertion because LOCK_open is being hold. Also dropping the
lock must not signal to any threads that the table has been
relinquished (related to the locking/flushing protocol).

The solution is to correct the way the table is reopenned
and the locks grabbed. When reopening the table and under
LOCK TABLES, the table version should be set to 0 so other
threads have to wait for the table. When grabbing the lock,
any other flush should be ignored because it's theoretically
a atomic operation. The chosen solution also fixes a potential
discrepancy between binlog and GRL (global read lock) because
table placeholders were being ignored, now a FLUSH TABLES WITH
READ LOCK will properly for table with open placeholders.

It's also important to mention that this patch doesn't fix
a potential deadlock if one uses two GRLs under LOCK TABLES
concurrently.


mysql-test/r/lock_multi.result:
  Add test case result for Bug#32395
mysql-test/r/trigger_notembedded.result:
  Add test case result for Bug#32395
mysql-test/t/lock_multi.test:
  Add test case for Bug#32395
mysql-test/t/trigger_notembedded.test:
  Enable test case for Bug#32395
sql/ha_ndbcluster.cc:
  Update close_cached_tables usage.
sql/ha_ndbcluster_binlog.cc:
  Update close_cached_tables usage.
sql/mysql_priv.h:
  Update close_cache_tables prototype.
sql/set_var.cc:
  Update close_cached_tables usage and set flag to wait for
  tables with placeholders. This is one of the places where
  a GRL can be obtained.
sql/sql_base.cc:
  Preserve old version for write locked tables and ignore
  pending flushes and update close_cache_tables to take
  into account name locked tables.
sql/sql_parse.cc:
  Update close_cached_tables usage and pass flag so that
  name locked tables are waited for.
sql/sql_table.cc:
  Protect the table against a impending GRL if under LOCK TABLES.
2007-12-12 19:44:14 -02:00
unknown
2a0d2fef51 Bug#12713 "Error in a stored function called from a SELECT doesn't
cause ROLLBACK of statement", part 1. Review fixes.

Do not send OK/EOF packets to the client until we reached the end of 
the current statement.
This is a consolidation, to keep the functionality that is shared by all 
SQL statements in one place in the server.
Currently this functionality includes:
- close_thread_tables()
- log_slow_statement().

After this patch and the subsequent patch for Bug#12713, it shall also include:
- ha_autocommit_or_rollback()
- net_end_statement()
- query_cache_end_of_result().

In future it may also include:
- mysql_reset_thd_for_next_command().


include/mysql_com.h:
  Rename now unused members of NET: no_send_ok, no_send_error, report_error.
  These were server-specific variables related to the client/server
  protocol. They have been made obsolete by this patch.
  
  Previously the same members of NET were used to store the error message
  both on the client and on the server. 
  The error message was stored in net.last_error (client: mysql->net.last_error,
  server: thd->net.last_error).
  The error code was stored in net.last_errno (client: mysql->net.last_errno,
  server: thd->net.last_errno).
  The server error code and message are now stored elsewhere 
  (in the Diagnostics_area), thus NET members are no longer used by the
  server.
  Rename last_error to client_last_error, last_errno to client_last_errno
  to avoid potential bugs introduced by merges.
include/mysql_h.ic:
  Update the ABI file to reflect a rename. 
  Renames do not break the binary compatibility.
libmysql/libmysql.c:
  Rename last_error to client_last_error, last_errno to client_last_errno.
  This is necessary to ensure no unnoticed bugs introduced by merged
  changesets.
  
  Remove net.report_error, net.no_send_ok, net.no_send_error.
libmysql/manager.c:
  Rename net.last_errno to net.client_last_errno.
libmysqld/lib_sql.cc:
  Rename net.last_errno to net.client_last_errno.
  
  Update the embedded implementation of the client-server protocol to
  reflect the refactoring of protocol.cc.
libmysqld/libmysqld.c:
  Rename net.last_errno to net.client_last_errno.
mysql-test/r/events.result:
  Update to reflect the change in mysql_rm_db(). Now we drop stored
  routines and events for a given database name only if there
  is a directory for this database name. ha_drop_database() and
  query_cache_invalidate() are called likewise. 
  Previously we would attempt to drop routines/events even if database
  directory was not found (it worked, since routines and events are stored
  in tables). This fixes Bug 29958 "Weird message on DROP DATABASE if mysql.proc
  does not exist".
  The change was done because the previous code used to call send_ok()
  twice, which led to an assertion failure when asserts against it were
  added by this patch.
mysql-test/r/grant.result:
  Fix the patch for Bug 16470, now FLUSH PRIVILEGES produces an error 
  if mysql.procs_priv is missing.
  This fixes the assert that send_ok() must not called after send_error()
  (the original patch for Bug 16470 was prone to this).
mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result:
  Produce a more detailed error message.
mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result:
  Produce a more detailed error message.
mysql-test/t/grant.test:
  Update the test, now FLUSH PRIVILEGES returns an error if mysql.procs_priv
  is missing.
server-tools/instance-manager/mysql_connection.cc:
  Rename net.last_errno to net.client_last_errno.
sql/ha_ndbcluster_binlog.cc:
  Add asserts. 
  
  Use getters to access statement status information.
  
  Add a comment why run_query() is broken. Reset the diagnostics area
  in the end of run_query() to fulfill the invariant that the diagnostics_area
  is never assigned twice per statement (see the comment in the code
  when this can happen). We still do not clear thd->is_fatal_error and
  thd->is_slave_error, which may lead to bugs, I consider the whole affair
  as something to be dealt with separately.
sql/ha_partition.cc:
  fatal_error() doesn't set an error by itself. Perhaps we should
  remove this method altogether and instead add a flag to my_error 
  to set thd->is_fatal_error property.
  
  Meanwhile, this change is a part of inspection made to the entire source
  code with the goal to ensure that fatal_error()
  is always accompanied by my_error().
sql/item_func.cc:
  There is no net.last_error anymore. Remove the obsolete assignment.
sql/log_event.cc:
  Use getters to access statement error status information.
sql/log_event_old.cc:
  Use getters to access statement error status information.
sql/mysqld.cc:
  Previously, if a continue handler for an error was found, my_message_sql() 
  would not set an error in THD. Since the current statement
  must be aborted in any case, find_handler() had a hack to assign 
  thd->net.report_error to 1.
  
  Remove this hack. Set an error in my_message_sql() even if the continue
  handler is found. The error will be cleared anyway when the handler
  is executed. This is one action among many in this patch to ensure the 
  invariant that whenever thd->is_error() is TRUE, we have a message in 
  thd->main_da.message().
sql/net_serv.cc:
  Use a full-blown my_error() in net_serv.cc to report an error,
  instead of just setting net->last_errno. This ensures the invariant that
  whenever thd->is_error() returns TRUE, we have a message in 
  thd->main_da.message().
  
  Remove initialization of removed NET members.
sql/opt_range.cc:
  Use my_error() instead of just raising thd->net.report_error. 
  This ensures the invariant that whenever thd->is_error() returns TRUE, 
  there is a message in thd->main_da.message().
sql/opt_sum.cc:
  Move invocation of fatal_error() right next to the place where
  we set the error message. That makes it easier to track that whenever
  fatal_error() is called, there is a message in THD.
sql/protocol.cc:
  Rename send_ok() and send_eof() to net_send_ok() and net_send_eof() 
  respectively. These functions write directly to the network and are not 
  for use anywhere outside the client/server protocol code. 
  
  Remove the code that was responsible for cases when either there is 
  no error code, or no error message, or both.
  Instead the calling code ensures that they are always present. Asserts
  are added to enforce the invariant.
  
  Instead of a direct access to thd->server_status and thd->total_warn_count
  use function parameters, since these from now on don't always come directly
  from THD.
  
  Introduce net_end_statement(), the single-entry-point replacement API for 
  send_ok(), send_eof() and net_send_error().
  
  Implement Protocol::end_partial_result_set to use in select_send::abort()
  when there is a continue handler.
sql/protocol.h:
  Update declarations.
sql/repl_failsafe.cc:
  Use getters to access statement status information in THD.
  Rename net.last_error to net.client_last_error.
sql/rpl_record.cc:
  Set an error message in prepare_record() if there is no default
  value for the field -- later we do print this message to the client.
sql/rpl_rli.cc:
  Use getters to access statement status information in THD.
sql/slave.cc:
  In create_table_from_dump() (a common function that is used in 
  LOAD MASTER TABLE SQL statement and COM_LOAD_MASTER_DATA), instead of hacks
  with no_send_ok, clear the diagnostics area when mysql_rm_table() succeeded.
  
  Update has_temporary_error() to work correctly when no error is set.
  This is the case when Incident_log_event is executed: it always returns
  an error but does not set an error message.
  
  Use getters to access error status information.
sql/sp_head.cc:
  Instead of hacks with no_send_error, work through the diagnostics area 
  interface to suppress sending of OK/ERROR packets to the client.
  
  Move query_cache_end_of_result before log_slow_statement(), similarly
  to how it's done in dispatch_command().
sql/sp_rcontext.cc:
  Remove hacks with assignment of thd->net.report_error, they are not
  necessary any more (see the changes in mysqld.cc).
sql/sql_acl.cc:
  Use getters to access error status information in THD.
sql/sql_base.cc:
  Access thd->main_da.sql_errno() only if there is an error. This fixes
  a bug when auto-discovery, that was effectively disabled under pre-locking.
sql/sql_binlog.cc:
  Remove hacks with no_send_ok/no_send_error, they are not necessary 
  anymore: the caller is responsible for network communication.
sql/sql_cache.cc:
  Disable sending of OK/ERROR/EOF packet in the end of dispatch_command
  if the response has been served from the query cache. This raises the 
  question whether we should store EOF packet in the query cache at all,
  or generate it anew for each statement (we should generate it anew), but
  this is to be addressed separately.
sql/sql_class.cc:
  Implement class Diagnostics_area. Please see comments in sql_class.h
  for details.
  
  Fix a subtle coding mistake in select_send::send_data: when on slave, 
  an error in Item::send() was ignored.
  The problem became visible due to asserts that the diagnostics area is
  never double assigned.
  
  Remove initialization of removed NET members.
  
  In select_send::abort() do not call select_send::send_eof(). This is
  not inheritance-safe. Even if a stored procedure continue handler is
  found, the current statement is aborted, not succeeded.
  Instead introduce a Protocol API to send the required response, 
  Protocol::end_partial_result_set().
  
  This simplifies implementation of select_send::send_eof(). No need
  to add more asserts that there is no error, there is an assert inside
  Diagnostics_area::set_ok_status() already.
  
  Leave no trace of no_send_* in the code.
sql/sql_class.h:
  Declare class Diagnostics_area. 
  
  Remove the hack with no_send_ok from
  Substatement_state.
  
  Provide inline implementations of send_ok/send_eof.
  
  Add commetns.
sql/sql_connect.cc:
  Remove hacks with no_send_error. 
  
  Since now an error in THD is always set if net->error, it's not necessary
  to check both net->error and thd->is_error() in the do_command loop.
  
  Use thd->main_da.message() instead of net->last_errno.
  
  Remove the hack with is_slave_error in sys_init_connect. Since now we do not
  reset the diagnostics area in net_send_error (it's reset at the beginning
  of the next statement), we can access it safely even after 
  execute_init_command.
sql/sql_db.cc:
  Update the code to satisfy the invariant that the diagnostics area is never
  assigned twice.
  Incidentally, this fixes Bug 29958 "Weird message on DROP DATABASE if 
  mysql.proc does not exist".
sql/sql_delete.cc:
  Change multi-delete to abort in abort(), as per select_send protocol.
  Fixes the merge error with the test for Bug 29136
sql/sql_derived.cc:
  Use getters to access error information.
sql/sql_insert.cc:
  Use getters to access error information.
sql-common/client.c:
  Rename last_error to client_last_error, last_errno to client_last_errno.
sql/sql_parse.cc:
  Remove hacks with no_send_error. Deploy net_end_statement().
  
  The story of COM_SHUTDOWN is interesting. Long story short, the server 
  would become on its death's door, and only no_send_ok/no_send_error assigned
  by send_ok()/net_send_error() would hide its babbling from the client.
  
  First of all, COM_QUIT does not require a response. So, the comment saying
  "Let's send a response to possible COM_QUIT" is not only groundless 
  (even mysqladmin shutdown/mysql_shutdown() doesn't send COM_QUIT after 
  COM_SHUTDOWN), it's plainly incorrect.
  
  Secondly, besides this additional 'OK' packet to respond to a hypothetical
  COM_QUIT, there was the following code in dispatch_command():
  
  if (thd->killed)
    thd->send_kill_message();
  if (thd->is_error()
    net_send_error(thd);
  
  This worked out really funny for the thread through which COM_SHUTDOWN
  was delivered: we would get COM_SHUTDOWN, say okay, say okay again, 
  kill everybody, get the kill signal ourselves, and then attempt to say 
  "Server shutdown in progress" to the client that is very likely long gone.
  
  This all became visible when asserts were added that the Diagnostics_area
  is not assigned twice.
  
  Move query_cache_end_of_result() to the end of dispatch_command(), since
  net_send_eof() has been moved there. This is safe, query_cache_end_of_result()
  is a no-op if there is no started query in the cache.
  
  Consistently use select_send interface to call abort() or send_eof()
  depending on the operation result.
  
  Remove thd->fatal_error() from reset_master(), it was a no-op. 
  in hacks with no_send_error woudl save us
  from complete breakage of the client/server protocol.
  
  Consistently use select_send::abort() whenever there is an error, 
  and select_send::send_eof() in case of success.
  The issue became visible due to added asserts.
sql/sql_partition.cc:
  Always set an error in THD whenever there is a call to fatal_error().
sql/sql_prepare.cc:
  Deploy class Diagnostics_area.
  Remove the unnecessary juggling with the protocol in 
  Select_fetch_protocol_binary::send_eof(). EOF packet format is 
  protocol-independent.
sql/sql_select.cc:
  Call fatal_error() directly in opt_sum_query.
  Call my_error() whenever we call thd->fatal_error().
sql/sql_servers.cc:
  Use getters to access error information in THD.
sql/sql_show.cc:
  Use getters to access error information in THD.
  
  Add comments.
  
  Call my_error() whenever we call fatal_error().
sql/sql_table.cc:
  Replace hacks with no_send_ok with the interface of the diagnostics area.
  
  Clear the error if ENOENT error in ha_delete_table().
sql/sql_update.cc:
  Introduce multi_update::abort(), which is the proper way to abort a
  multi-update. This fixes the merge conflict between this patch and
  the patch for Bug 29136.
sql/table.cc:
  Use a getter to access error information in THD.
sql/tztime.cc:
  Use a getter to access error information in THD.
2007-12-12 18:21:01 +03:00
unknown
841600c05f remove memleak cased by dynamic variables being lost 2007-12-11 19:51:44 +01:00
unknown
c853fa4fe2 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge


sql/ha_ndbcluster_binlog.cc:
  Auto merged
2007-12-10 10:26:01 +01:00
unknown
7ed596398b bug#29562 default collation of ucs2_unicode_ci crashes slave
Problem: some pieces of code relied on the default character
set settings, which didn't work in case of default character set
ucs2.
Fix: Specifying character set explicitly, not to depend on
the default settings.


mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result:
  Recording correct test result
mysql-test/suite/rpl_ndb/t/disabled.def:
  Enabling test
sql/ha_ndbcluster_binlog.cc:
  Character set of the NDB helper tables should
  not rely of the default settings, to avoid creating
  tables in different character sets on master and slave.
  Adding explicit character set. UTF8 should be fine.
  
  character_set_client should not rely on the default
  character set settings, which can be ucs2. Helper SQL queries
  sent by NDB are all in pure ASCII. Setting client_character_set
  to latin1.
sql/log_event.cc:
  Adding assert to make sure that binary log does not have 
  queries in character set which parser does not understand
  (e.g. ucs2).
2007-11-28 15:35:25 +04:00
unknown
678dd332cc Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge


sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
2007-11-16 11:15:53 +01:00
unknown
c8450b278d Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
corrupts a MERGE table
Bug 26867 - LOCK TABLES + REPAIR + merge table result in
            memory/cpu hogging
Bug 26377 - Deadlock with MERGE and FLUSH TABLE
Bug 25038 - Waiting TRUNCATE
Bug 25700 - merge base tables get corrupted by
            optimize/analyze/repair table
Bug 30275 - Merge tables: flush tables or unlock tables
            causes server to crash
Bug 19627 - temporary merge table locking
Bug 27660 - Falcon: merge table possible
Bug 30273 - merge tables: Can't lock file (errno: 155)

The problems were:

Bug 26379 - Combination of FLUSH TABLE and REPAIR TABLE
                corrupts a MERGE table

  1. A thread trying to lock a MERGE table performs busy waiting while
     REPAIR TABLE or a similar table administration task is ongoing on
     one or more of its MyISAM tables.
  
  2. A thread trying to lock a MERGE table performs busy waiting until all
     threads that did REPAIR TABLE or similar table administration tasks
     on one or more of its MyISAM tables in LOCK TABLES segments do UNLOCK
     TABLES. The difference against problem #1 is that the busy waiting
     takes place *after* the administration task. It is terminated by
     UNLOCK TABLES only.
  
  3. Two FLUSH TABLES within a LOCK TABLES segment can invalidate the
     lock. This does *not* require a MERGE table. The first FLUSH TABLES
     can be replaced by any statement that requires other threads to
     reopen the table. In 5.0 and 5.1 a single FLUSH TABLES can provoke
     the problem.

Bug 26867 - LOCK TABLES + REPAIR + merge table result in
            memory/cpu hogging

  Trying DML on a MERGE table, which has a child locked and
  repaired by another thread, made an infinite loop in the server.

Bug 26377 - Deadlock with MERGE and FLUSH TABLE

  Locking a MERGE table and its children in parent-child order
  and flushing the child deadlocked the server.

Bug 25038 - Waiting TRUNCATE

  Truncating a MERGE child, while the MERGE table was in use,
  let the truncate fail instead of waiting for the table to
  become free.

Bug 25700 - merge base tables get corrupted by
            optimize/analyze/repair table

  Repairing a child of an open MERGE table corrupted the child.
  It was necessary to FLUSH the child first.

Bug 30275 - Merge tables: flush tables or unlock tables
            causes server to crash

  Flushing and optimizing locked MERGE children crashed the server.

Bug 19627 - temporary merge table locking

  Use of a temporary MERGE table with non-temporary children
  could corrupt the children.

  Temporary tables are never locked. So we do now prohibit
  non-temporary chidlren of a temporary MERGE table.

Bug 27660 - Falcon: merge table possible

  It was possible to create a MERGE table with non-MyISAM children.

Bug 30273 - merge tables: Can't lock file (errno: 155)

  This was a Windows-only bug. Table administration statements
  sometimes failed with "Can't lock file (errno: 155)".

These bugs are fixed by a new implementation of MERGE table open.

When opening a MERGE table in open_tables() we do now add the
child tables to the list of tables to be opened by open_tables()
(the "query_list"). The children are not opened in the handler at
this stage.

After opening the parent, open_tables() opens each child from the
now extended query_list. When the last child is opened, we remove
the children from the query_list again and attach the children to
the parent. This behaves similar to the old open. However it does
not open the MyISAM tables directly, but grabs them from the already
open children.

When closing a MERGE table in close_thread_table() we detach the
children only. Closing of the children is done implicitly because
they are in thd->open_tables.

For more detail see the comment at the top of ha_myisammrg.cc.

Changed from open_ltable() to open_and_lock_tables() in all places
that can be relevant for MERGE tables. The latter can handle tables
added to the list on the fly. When open_ltable() was used in a loop
over a list of tables, the list must be temporarily terminated
after every table for open_and_lock_tables().
table_list->required_type is set to FRMTYPE_TABLE to avoid open of
special tables. Handling of derived tables is suppressed.
These details are handled by the new function
open_n_lock_single_table(), which has nearly the same signature as
open_ltable() and can replace it in most cases.

In reopen_tables() some of the tables open by a thread can be
closed and reopened. When a MERGE child is affected, the parent
must be closed and reopened too. Closing of the parent is forced
before the first child is closed. Reopen happens in the order of
thd->open_tables. MERGE parents do not attach their children
automatically at open. This is done after all tables are reopened.
So all children are open when attaching them.

Special lock handling like mysql_lock_abort() or mysql_lock_remove()
needs to be suppressed for MERGE children or forwarded to the parent.
This depends on the situation. In loops over all open tables one
suppresses child lock handling. When a single table is touched,
forwarding is done.

Behavioral changes:
===================

This patch changes the behavior of temporary MERGE tables.
Temporary MERGE must have temporary children.
The old behavior was wrong. A temporary table is not locked. Hence
even non-temporary children were not locked. See
Bug 19627 - temporary merge table locking.

You cannot change the union list of a non-temporary MERGE table
when LOCK TABLES is in effect. The following does *not* work:
CREATE TABLE m1 ... ENGINE=MRG_MYISAM ...;
LOCK TABLES t1 WRITE, t2 WRITE, m1 WRITE;
ALTER TABLE m1 ... UNION=(t1,t2) ...;
However, you can do this with a temporary MERGE table.

You cannot create a MERGE table with CREATE ... SELECT, neither
as a temporary MERGE table, nor as a non-temporary MERGE table.
CREATE TABLE m1 ... ENGINE=MRG_MYISAM ... SELECT ...;
Gives error message: table is not BASE TABLE.


include/my_base.h:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added HA_EXTRA_ATTACH_CHILDREN and HA_EXTRA_DETACH_CHILDREN.
include/myisammrg.h:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added element 'children_attached' to MYRG_INFO.
  Added declarations for myrg_parent_open(),
  myrg_attach_children() and myrg_detach_children()
  for the new MERGE table open approach.
mysql-test/extra/binlog_tests/blackhole.test:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Preliminarily added new error message with a comment.
mysql-test/r/create.result:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Fixed test result.
mysql-test/r/delayed.result:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Moved test result from here to merge.result.
mysql-test/r/merge.result:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Fixed/added test result.
mysql-test/r/myisam.result:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Moved test result for bug 8306 from here to merge.result.
mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Fixed test result.
mysql-test/t/create.test:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Fixed error number.
mysql-test/t/delayed.test:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Moved test from here to merge.test.
mysql-test/t/merge.test:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Fixed test for new temporary MERGE table behavior.
  Exchanged error numbers by symbolic codes.
  Added tests. Included are tests for bugs
  8306 (moved from myisam.test), 26379, 19627, 25038, 25700, 26377,
  26867, 27660, 30275, and 30273.
  Fixed changes resulting from disabled CREATE...SELECT.
  Integrated tests moved from delayed.test and myisam.test to here.
mysql-test/t/myisam.test:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Moved test for bug 8306 from here to merge.test.
mysys/thr_lock.c:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added code to let the owner of a high priority lock (TL_WRITE_ONLY)
  to bypass its own lock.
sql/ha_ndbcluster_binlog.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added 'thd' argument to init_tmp_table_share().
sql/handler.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added 'thd' argument to init_tmp_table_share().
sql/mysql_priv.h:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Removed declaration of check_merge_table_access(). It is now static
  in sql_parse.cc.
  Added declaration for fix_merge_after_open().
  Renamed open_and_lock_tables() to open_and_lock_tables_derived()
  with additional parameter 'derived'.
  Added inline functions simple_open_n_lock_tables() and
  open_and_lock_tables(), which call open_and_lock_tables_derived()
  and add the argument for 'derived'.
  Added new function open_n_lock_single_table(), which can be used
  as an replacement for open_ltable() in most situations. Internally
  it calls simple_open_n_lock_tables() so hat it is appropriate for
  MERGE tables.
  Added 'thd' argument to init_tmp_table_share().
sql/slave.cc:
  ug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added comment.
sql/sql_base.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  
  Defined new functions add_merge_table_list(),
  attach_merge_children(), detach_merge_children(), and
  fix_merge_after_open() for the new MERGE table open approach.
  
  Added calls of the new functions to
  close_handle_and_leave_table_as_lock(), close_thread_tables(),
  close_thread_table(), unlink_open_table(), reopen_name_locked_table(),
  reopen_table(), drop_locked_tables(), close_temporary_table(),
  and open_tables() respectively.
  
  Prevented special lock handling of merge children (like
  mysql_lock_remove, mysql_lock_merge or mysql_lock_abort)
  at many places. Some of these calls are forwarded to the
  parent table instead.
  
  Added code to set thd->some_tables_deleted for every thread that has
  a table open that we are flushing.
  Added code for MERGE tables to unlink_open_table().
  Added MERGE children to the list of unusable tables in open_table().
  Added MERGE table handling to reopen_table().
  Added lock handling and closing of a parent before the children
  in close_data_files_and_morph_locks().
  Added code for re-attaching children in reopen_tables().
  Added MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN to the locking flags and
  error reporting after mysql_lock_tables() in reopen_tables().
  Added lock handling and closing of a parent before the children
  in close_old_data_files().
  Added lock handling and detaching in drop_locked_tables().
  Added code for removing the children list from the statement list
  to prepare for a repetition in open_tables().
  Added new function open_n_lock_single_table(), which can be used
  as an replacement for open_ltable() in most situations. Internally
  it calls simple_open_n_lock_tables() so hat it is appropriate for
  MERGE tables.
  Disabled use of open_ltable() for MERGE tables.
  Removed function simple_open_n_lock_tables(). It is now inline
  declared in mysql_priv.h.
  Renamed open_and_lock_tables() to open_and_lock_tables_derived()
  with additional parameter 'derived'. open_and_lock_tables() is now
  inline declared in mysql_priv.h.
  Added a check for end-of-list in two loops in lock_tables().
  Added 'thd' argument to init_tmp_table_share().
sql/sql_insert.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Changed from open_ltable() to open_n_lock_single_table() in
  handle_delayed_insert().
  Reestablished LEX settings after lex initialization.
  Added 'thd' argument to init_tmp_table_share().
sql/sql_parse.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Made check_merge_table_access() a static function.
  Disabled use of CREATE...SELECT for MERGE tables.
sql/sql_partition.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Fixed comment typo.
sql/sql_select.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added 'thd' argument to init_tmp_table_share().
sql/sql_table.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Optimized use of mysql_ha_flush() in mysql_rm_table_part2().
  Disabled the use of MERGE tables with prepare_for_restore() and
  prepare_for_repair().
  Changed from open_ltable() to open_n_lock_single_table() in
  mysql_alter_table() and mysql_checksum_table().
  Disabled change of child list under LOCK TABLES.
  Initialized table_list->table in mysql_recreate_table().
sql/sql_trigger.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added code for allowing CREATE TRIGGER under LOCK TABLE, to be able
  to test it with MERGE tables.
sql/table.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added 'thd' argument to init_tmp_table_share().
  Setting table_map_id from query_id in init_tmp_table_share().
  Added member function TABLE::is_children_attached().
sql/table.h:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added access method get_table_def_version() to TABLE_SHARE.
  Added elements for MERGE tables to TABLE and TABLE_LIST.
storage/myisam/ha_myisam.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added an unrelated comment to the function comment of table2myisam().
storage/myisam/ha_myisam.h:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added new member function MI_INFO::file_ptr().
storage/myisammrg/ha_myisammrg.cc:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added callback functions to support parent open and children attach
  of MERGE tables.
  Changed ha_myisammrg::open() to initialize storage engine structures
  and create a list of child tables only. Child tables are not opened.
  Added ha_myisammrg::attach_children(), which does now the main part
  of MERGE open.
  Added ha_myisammrg::detach_children().
  Added calls to ::attach_children() and ::detach_children() to
  ::extra() on HA_EXTRA_ATTACH_CHILDREN and HA_EXTRA_DETACH_CHILDREN
  respectively.
  Added a check for matching TEMPORARY type for children against
  parent.
  Added a check for table def version.
  Added support for thd->open_options to attach_children().
  Changed child path name generation for temporary tables so that
  it does nothing special for temporary tables.
storage/myisammrg/ha_myisammrg.h:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added elements to class ha_myisammrg to support the new
  open approach.
  Changed empty destructor definition to a declaration.
  Implemented in ha_myisammrg.cc.
  Added declaration for methods attach_children() and
  detach_children().
  Added definition for method table_ptr() for use with
  callback functions.
storage/myisammrg/myrg_close.c:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Added a check to avoid closing of MyISAM tables when the
  child tables are not attached.
  Added freeing of rec_per_key_part when the child tables
  are not attached.
storage/myisammrg/myrg_extra.c:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  Some ::extra() functions and ::reset() can be called when
  children are detached.
storage/myisammrg/myrg_open.c:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
              corrupts a MERGE table
  
  Kept old myrg_open() for MERGE use independent from MySQL.
  Removed an always true condition in myrg_open().
  Set children_attached for independent MERGE use in myrg_open().
  
  Added myrg_parent_open(), myrg_attach_children(), and
  myrg_detach_children() for the new MERGE table open approach.
mysql-test/r/merge-big.result:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table
  New test result
mysql-test/t/merge-big.test:
  Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table
  New test case
2007-11-15 20:25:43 +01:00
unknown
1b98a962d5 Merge mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-main
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-last_with_main


libmysqld/lib_sql.cc:
  Auto merged
mysql-test/include/mix1.inc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
sql/event_scheduler.cc:
  Auto merged
sql/events.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_connect.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2007-11-12 21:09:48 +01:00
unknown
72bdc00ec9 Merge whalegate.ndb.mysql.com:/home/tomas/cge-5.1
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge


mysql-test/suite/ndb/r/ndb_multi.result:
  Auto merged
mysql-test/suite/ndb/t/ndb_multi.test:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
2007-11-12 10:50:58 +01:00