Commit graph

3438 commits

Author SHA1 Message Date
Michael Widenius
5f607a2c70 Automatic merge with 5.1 2011-10-05 16:53:35 +03:00
Michael Widenius
1351bef4df Fix for issue found in buildbot where mysqld.*.err files was missing
Added suppression message for valgrind failure found on OpenSuSE 11.1

mysql-test/mysql-test-run.pl:
  Fix for issue found in buildbot where mysqld.*.err files was missing
  Patch by Kristian Nielsen
mysql-test/valgrind.supp:
  Added suppression message for valgrind failure found on OpenSuSE 11.1
sql/mysqld.cc:
  Added missing space to comment
2011-10-05 16:37:05 +03:00
Michael Widenius
47d5a20b14 Automatic merge with 5.2 2011-10-05 16:56:17 +03:00
Michael Widenius
c85d1efc82 Automatic merge 2011-09-26 23:54:00 +03:00
Michael Widenius
7800d93bc3 Allow one to block an account by using GRANT max_user_connections = -1
One can set @@global.max_user_connections to -1 to block anyone, except SUPER user, to login.
If max_user_connection is 0, one can't change it without a restart (needed to get user connections counting to work correctly)


mysql-test/r/system_mysql_db.result:
  Changed max_user_connections to handle negative numbers.
mysql-test/r/user_limits-2.result:
  New test case that one can't change max_user_connection if it was 0
mysql-test/r/user_limits.result:
  Fixed wrong error messages.
mysql-test/r/variables.result:
  Store / restore max_user_connections (needed as there is now a --master.opt file that changes it)
mysql-test/t/subselect_mat_cost-master.opt:
  Enable slow query log (as this test found some errors in slow query logging)
mysql-test/t/user_limits-2.test:
  New test case that one can't change max_user_connection if it was 0
mysql-test/t/user_limits-master.opt:
  Set max_user_connections (as one can't change it if it was 0)
mysql-test/t/user_limits.test:
  Test max_user_connections -1
mysql-test/t/variables-master.opt:
  Set max_user_connections (as one can't change it if it was 0)
mysql-test/t/variables.test:
  Set/restore max_user_connections
scripts/Makefile.am:
  Add a text message to mysql_fix_privilege_tables.sql that it's automaticly generated
scripts/mysql_system_tables.sql:
  Change max_user_connections to signed
scripts/mysql_system_tables_fix.sql:
  Change max_user_connections to signed
sql/item_func.cc:
  Change SHOW_INT to be signed.
  (Needed for max_user_connections and it's probably a bug that it was not originally signed)
sql/log.cc:
  Remove some code that was not needed (All these variables are reset at start of query)
sql/mysql_priv.h:
  Made max_user_connections signed.
  Added max_user_connections_checking
sql/mysqld.cc:
  Added max_user_connections_checking so that we know if max_user_connections was 0 at startup
  (Which means that we will not do connection counting for accounts that don't have user resource limits)
  Set thd->start_utime at same time as thr_create_utime. (Before start_utime could be < thr_create_utime which lead to wrong query counting)
sql/set_var.cc:
  Don't allow one to change 'max_user_connections' if it was 0 at startup.
sql/sql_acl.cc:
  Change user_connection counting to be negative.
sql/sql_connect.cc:
  If max_user_connections is < 0 then only SUPER user can login.
  Fixed wrong variable names for error messages.
  Fixed wrong initial value for questions.
  Set thd->start_utime and thd->thr_create_utime at startup.  Needed to get time_out_user_resource_limits() to work.
sql/sql_show.cc:
  SHOW_INT is now negative
sql/sql_yacc.yy:
  Support negative values for MAX_USER_CONNECTIONS
sql/structs.h:
  Make user connect counting work with signed numbers.
2011-09-26 20:26:47 +03:00
Sergei Golubchik
14c767ca48 fix typo: binlog_annotate_rows_events -> binlog_annotate_row_events 2011-09-23 12:00:52 +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
Michael Widenius
574e51e5fd Merge with 5.2 2011-09-15 17:25:37 +03:00
Michael Widenius
4139bba281 Increased version number
Give proper error to client on shutdown.

configure.in:
  Increased version number
mysql-test/mysql-test-run.pl:
  Ignore errors that one can get while running with --mysqld=--log-warnings=2
mysql-test/r/variables.result:
  Remember original value of log_warnings
mysql-test/suite/rpl/r/rpl_idempotency.result:
  Ignore errors that one can get while running with --mysqld=--log-warnings=2
mysql-test/suite/rpl/t/rpl_idempotency.test:
  Ignore errors that one can get while running with --mysqld=--log-warnings=2
mysql-test/t/variables.test:
  Remember original value of log_warnings
sql/mysqld.cc:
  Give proper error to close_connection() on shutdown
storage/maria/ha_maria.cc:
  Added missing DBUG_RETURN
2011-09-13 18:46:47 +03:00
Michael Widenius
3fb22ac5e1 Merge with 5.2 2011-09-10 18:01:27 +03:00
Michael Widenius
8fb10c24d7 Fixed that automatic killing of delayed insert thread (in flush, alter table etc) will not abort auto-repair of MyISAM table.
Give more information when finding an error in a MyISAM table.
When killing system thread, use KILL_SYSTEM_THREAD instead of KILL_CONNECTION to make it easier to ignore the signal in sensitive context (like auto-repair)
Added new kill level: KILL_SERVER that will in the future to be used to signal killed by shutdown.
Add more warnings about killed connections when warning level > 3

include/myisamchk.h:
  Added counting of printed info/notes
mysys/mf_iocache.c:
  Remove duplicate assignment
sql/handler.cc:
  Added test of KILL_SERVER
sql/log.cc:
  Ignore new 'kill' error ER_NEW_ABORTING_CONNECTION when requesting query error code.
sql/mysqld.cc:
  Add more warnings for killed connections when warning level > 3
sql/scheduler.cc:
  Added checks for new kill signals
sql/slave.cc:
  Ignore new kill signal ER_NEW_ABORTING_CONNECTION
sql/sp_head.cc:
  Fixed assignment to bool
  Added testing of new kill signals
sql/sql_base.cc:
  Use KILL_SYSTEM_THREAD to auto-kill system threads
sql/sql_class.cc:
  Add more warnings for killed connections when warning level > 3
  thd_killed() now ignores KILL_BAD_DATA and THD::KILL_SYSTEM_THREAD as these should not abort sensitive operations.
sql/sql_class.h:
  Added KILL_SYSTEM_THREAD and KILL_SERVER
sql/sql_connect.cc:
  Added handling of KILL_SERVER
sql/sql_insert.cc:
  Use KILL_SYSTEM_THREAD to auto-kill system threads
  Added handling of KILL_SERVER
sql/sql_parse.cc:
  Add more warnings for killed connections when warning level > 3
  Added checking that thd->abort_on_warning is reset at end of query.
sql/sql_show.cc:
  Update condition for when a query is 'killed'
storage/myisam/ha_myisam.cc:
  Added counting of info/notes printed
storage/myisam/mi_check.c:
  Always print an an error if we find data errors when checking/repairing a MyISAM table.
  When a repair was killed, don't retry repair.
  Added assert if sort_get_next_record() returned an error without an error message.
  Removed nonsence check "if (sort_param->read_cache.error < 0)" in repair.
storage/myisam/myisamchk.c:
  Added counting of notes printed
storage/pbxt/src/thread_xt.cc:
  Better error message.
2011-09-09 19:44:07 +03:00
unknown
b152c4c71d Merge 5.2->5.3 2011-09-02 15:10:10 +03:00
Michael Widenius
13e4d54795 Fixed lp:814238 "safe_mutex issues must be assertions in debug binary"
Added --debug-assert-on-error variable which, if set, will cause safe_mutex to assert if it founds an error.

include/my_sys.h:
  Added my_assert_on_error
mysys/my_static.c:
  Added my_assert_on_error
mysys/thr_mutex.c:
  Assert when found wrong mutex usage if my_assert_on_error is set
sql/mysqld.cc:
  Added setting of my_assert_on_error
2011-09-02 12:41:20 +03:00
Michael Widenius
31c8c95bb2 Added logging of all errors from my_read/my_write/my_pread/my_pwrite/my_open & my_malloc to mysqld error log if one sets log-warning to 10 or 11
The idea is that my_global_flags is ored to the MyFlags parameter for the above functions if the MY_WME flag is not set.
As the my_global_flags has ME_JUST_INFO (mark error as 'note') and possible ME_NOREFRESH (write error to log) this will force mysqld to log the not critical error to the log as a note.


 

include/my_sys.h:
  Moved MY_SYNC_DIR to ensure it never clashes with ME_JUST_INFO
  Added my_global_flags
mysql-test/Makefile.am:
  Removed not used bugs directory
mysys/my_init.c:
  Added my_global_flags, a variable that is ored to MyFlags in a those mysys functions we want extra logging.
mysys/my_malloc.c:
  Added support for my_global_flags
mysys/my_open.c:
  Added support for my_global_flags
mysys/my_pread.c:
  Added support for my_global_flags
mysys/my_read.c:
  Added support for my_global_flags
mysys/my_static.c:
  Added my_global_flags
mysys/my_write.c:
  Added support for my_global_flags
sql/mysqld.cc:
  Set my_global_flags for warning levels 10 & 11
sql/sql_base.cc:
  Don't increment unhandled errors for notes or warnings.
2011-09-02 01:22:34 +03:00
Michael Widenius
8b7a63b17f Added logging of all messages (also system warnings) one gets during a MyISAM recovery or auto-recovery.
sql/mysqld.cc:
  Log errors if thd->log_all_errors is set
sql/sql_class.cc:
  Add log_all_errors
sql/sql_class.h:
  Add log_all_errors
storage/myisam/ha_myisam.cc:
  Write db and table name for all logged errors
  Log errors also during auto_recovery
  During auto_recovery, set thd->log_all_errors if log_warnings >2 to ensure that system errors are also logged to file
2011-08-29 20:38:21 +03:00
unknown
9313032283 MWL#234: Implement option to switch between master-side and client-side filtering of @@skip_replication events. 2011-08-16 11:51:02 +02:00
unknown
b1a13cb15a MWL#234: After-review fixes, including better names for the new system variables. 2011-08-12 13:18:34 +02:00
unknown
c4d69f1775 MWL#234: Support for marking binlog events to not be replicated, and for telling slaves not to replicate events with such mark 2011-08-11 11:38:52 +02:00
Vladislav Vaintroub
b55715572a Limit query length in error log to 64K, to avoid output of full blobs 2011-08-03 13:58:46 +02:00
Vladislav Vaintroub
6a46fd5e2d Enhance crash reporting. Fix
LPBug#819711 : optimizer_switch must be reported on segfault
LPBug#820169:  Full query text must be reported on crash
2011-08-03 13:42:53 +02:00
Alexander Nozdrin
9312697530 Manual merge from mysql-5.1. 2011-07-22 11:50:44 +04:00
Alexander Nozdrin
3a786df2d5 Manual merge from mysql-5.0. 2011-07-22 11:46:45 +04:00
Alexander Nozdrin
cb5239954b For for Bug#12696072: FIX OUTDATED COPYRIGHT NOTICES IN RUNTIME RELATED CLIENT
TOOLS

Backport a fix for Bug 57094 from 5.5.
The following revision was backported:

# revision-id: alexander.nozdrin@oracle.com-20101006150613-ls60rb2tq5dpyb5c
# parent: bar@mysql.com-20101006121559-am1e05ykeicwnx48
# committer: Alexander Nozdrin <alexander.nozdrin@oracle.com>
# branch nick: mysql-5.5-bugteam-bug57094
# timestamp: Wed 2010-10-06 19:06:13 +0400
# message:
#   Fix for Bug 57094 (Copyright notice incorrect?).
#   
#   The fix is to:
#     - introduce ORACLE_WELCOME_COPYRIGHT_NOTICE define to have a single place
#       to specify copyright notice;
#     - replace custom copyright notices with ORACLE_WELCOME_COPYRIGHT_NOTICE
#       in programs.
2011-07-22 11:45:15 +04:00
Igor Babaev
63abf00a62 Made the optimizer switches 'derived_merge' and 'derived_with_keys'
off by default.
2011-07-21 14:23:08 -07:00
unknown
c1b6eb1490 Merge of subquery cache off by default. 2011-07-15 12:16:46 +03:00
unknown
af284b55f0 Make subquery cache off by default.
mysql-test/r/subselect_scache.result:
  Test with subquery cache on.
mysql-test/t/subselect_scache.test:
  Test with subquery cache on.
2011-07-15 11:36:36 +03:00
Igor Babaev
03081bc1fd Changed the default setting of the optimizer switch 'optimize_join_buffer_size'.
Made it 'off' by default.
2011-07-14 22:24:59 -07:00
Sergei Golubchik
a844635637 use PSI wrappers in aria and other non-MySQL code 2011-07-13 21:10:18 +02:00
Sergei Golubchik
aac3a1eac9 fix misplaced and non-working if() in the grammar
few small post-merge fixes
2011-07-12 17:41:13 +02:00
Sergei Golubchik
2005689700 sys_vars changes and cleanups 2011-07-11 20:33:39 +02:00
Sergei Golubchik
49501b4ccb fix memory leaks and other problems found by safemalloc
client/mysql_upgrade.c:
  missing DBUG_RETURN
client/mysqladmin.cc:
  client plugin memory wasn't freed
client/mysqlcheck.c:
  client plugin memory, defaults, a result set, a command-line option value were not freed.
  missing DBUG_RETURN.
client/mysqldump.c:
  client plugin memory wasn't freed
client/mysqlslap.c:
  client plugin memory wasn't freed
client/mysqltest.cc:
  hopeless. cannot be fixed.
mysql-test/valgrind.supp:
  Bug#56666 is now fixed.
mysys/array.c:
  really, don't allocate if the caller didn't ask to.
mysys/my_init.c:
  safemalloc checks must be done at the very end
mysys/my_thr_init.c:
  not needed anymore
sql-common/client.c:
  memory leak
sql/log.cc:
  log_file was not closed, memory leak.
sql/mysqld.cc:
  fix bug#56666 (causing many P_S related memory leaks).
  close_active_mi() not called for --bootstrap, memory leak.
sql/sql_lex.cc:
  redo Lex->mi handling
sql/sql_lex.h:
  redo Lex->mi handling
sql/sql_plugin.cc:
  plugins having PLUGIN_VAR_MEMALLOC string variables have this variables allocated in every THD.
  The memory was freed in ~THD but only if plugin was still active. If plugin was unloaded the
  variable was not found and the memory was lost. By loading and unloading plugins an arbitrary
  amount of memory can be lost.
sql/sql_repl.cc:
  redo Lex->mi handling
sql/sql_yacc.yy:
  completely wrong handling of Lex->mi - run-time memory leak, by repeating the statement
  arbitrary amount of memory can be lost.
  
  Lex->mi.repl_ignore_server_ids_opt was allocated when parsing CHANGE MASTER,
  and freed after executing the statement. if parser failed on syntax (or another)
  error the statement was never executed. Lex->mi was simply bzero-ed for the next
  CHANGE MASTER  statement.
sql/table.cc:
  didn't compile
storage/perfschema/pfs_lock.h:
  Bug#56666 is fixed
2011-07-10 20:09:17 +02:00
Sergei Golubchik
172f5e28ba add safemalloc back
... but differently

client/mysqltest.cc:
  my_safe_print_str() don't append \n anymore
dbug/dbug.c:
  restore safemalloc as a part of dbug suite
dbug/user.r:
  restore 'S' flag documentation
include/my_dbug.h:
  restore safemalloc as a part of dbug suite
include/my_sys.h:
  move valgrind defines to a dedicated header
mysys/my_malloc.c:
  use new safemalloc
mysys/stacktrace.c:
  don't append \n. let the calller do it, if needed
sql/mysqld.cc:
  my_safe_print_str() don't append \n anymore
2011-07-10 19:55:54 +02:00
Sergey Petrunya
41c766f30d Make table_elimination=on|off flag to be always present in @@optimizer_switch. 2011-07-08 19:09:30 +04:00
Sergey Petrunya
1492de8563 Set the default to be mrr=off,mrr_sort_keys=off:
- Set the default
- Adjust the testcases so that 'new' tests are run with optimizations turned on.
- Pull out relevant tests from "irrelevant" tests and run them with optimizations on.
- Run range.test and innodb.test with both mrr=on and mrr=off
2011-07-08 18:46:47 +04:00
Davi Arnaut
71e0ff64f0 Bug#12727287: Maintainer mode compilation fails with gcc 4.6
GCC 4.6 has new -Wunused-but-set-variable flag, which is enabled
by -Wall, that causes GCC to emit a warning whenever a local variable
is assigned to, but otherwise unused (aside from its declaration).

Since the maintainer mode uses -Wall and -Werror, source code which
triggers these warnings will be rejected. That is, these warnings
become hard errors.

The solution is to fix the code which triggers these specific warnings.
In most of the cases, this is a welcome cleanup as code which triggers
this warning is probably dead anyway.

dbug/dbug.c:
  Unused but set.
libmysqld/lib_sql.cc:
  Length is not necessary as the converted error message is always
  null-terminated.
sql/item_func.cc:
  Make get_var_with_binlog private to this compilation unit.
  If a error was raised, do not attempt to evaluate the user
  variable as the statement execution will be interrupted
  anyway.
sql/mysqld.cc:
  Use a void expression to silence the warning. Avoids the use of
  macros that would make the code more unreadable than it already is.
sql/protocol.cc:
  Length is not necessary as the converted error message is always
  null-terminated. Remove unnecessary casts and assignment.
sql/sql_class.h:
  Function is only used in a single compilation unit.
sql/sql_load.cc:
  Only use the variable outside of EMBEDDED_LIBRARY.
storage/innobase/btr/btr0cur.c:
  Do not retrieve field, only the record length is being used.
storage/perfschema/pfs.cc:
  Use a void expression to silence the warning.
tests/mysql_client_test.c:
  Unused but set.
unittest/mysys/lf-t.c:
  Unused but set.
2011-07-07 08:22:43 -03:00
Sunanda Menon
af6ddeca48 Merge from mysql-5.0.94-release 2011-07-06 11:36:39 +02:00
unknown
7d605ec45f Merge from mysql-5.5.14-release 2011-07-06 01:13:50 +02:00
Karen Langford
f6398a86dd Merge from mysql-5.1.58-release 2011-07-06 00:56:51 +02:00
Vladislav Vaintroub
f9cb1467b8 merge Windows performance patches into 5.3 2011-07-05 21:46:53 +02:00
Sergey Petrunya
c1de6f8b77 Change the default @@optimizer_switch setting from
semijoin=on,firstmatch=on,loosescan=on
to
  semijoin=off,firstmatch=off,loosescan=off
Adjust the testcases:
- Modify subselect*.test and join_cache.test so that all tests
  use the same execution paths as before (i.e. optimizations that
  are being tested are enabled)
- Let all other test files run with the new default settings (i.e.
  with new optimizations disabled)
- Copy subquery testcases from these files into t/subselect_extra.test
  which will run them with new optimizations enabled.
2011-07-05 01:44:15 +04:00
Kent Boortz
027b5f1ed4 Updated/added copyright headers 2011-07-03 17:47:37 +02:00
Sergei Golubchik
b4a0b2c2f8 post-merge fixes.
most tests pass.
5.3 merge is next
2011-07-02 22:12:12 +02:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Michael Widenius
3c78bfe7f1 Added progress reporting for alter table, LOAD DATA INFILE and for aria tables: check table, repair table, analyze table.
- The client gets a progress report message that triggers a callback function if requested with mysql_options(MYSQL_PROGRESS_CALLBACK, function)
- Added Progress field last to 'show processlist'
- Stage, Max_stage and Progress field added to information_schema.progresslist
- The 'mysql' client by defaults enables progress reports when the output is a tty.
- Added progress_report_time time variable to configure how often progress reports is sent to client
Added read only system variable 'in_transaction' which is 1 if we have executed a BEGIN statement.


client/client_priv.h:
  Added OPT_REPORT_PROGRESS
client/mysql.cc:
  Added option --progress-reports (on by default if not batch mode)
  Progress reports is written to stdout for long running commands
include/Makefile.am:
  Added mysql/service_progress_report.h
include/myisamchk.h:
  Added variables to be able to do progress reporting in Aria and later in MyISAM
include/mysql.h:
  Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK
include/mysql.h.pp:
  Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK
include/mysql/plugin.h:
  Added functions for reporting progress.
include/mysql/plugin_auth.h.pp:
  Added functions for reporting progress.
include/mysql_com.h:
  Added CLIENT_PROGRESS mysql_real_connect() flag.
include/sql_common.h:
  Added callback function for reporting progress
mysql-test/r/old-mode.result:
  Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode.
mysql-test/suite/funcs_1/datadict/datadict_priv.inc:
  Added new column
mysql-test/suite/funcs_1/datadict/processlist_priv.inc:
  Test all new PROCESSLIST columns
mysql-test/suite/funcs_1/r/is_columns_is.result:
  Updated results
mysql-test/suite/funcs_1/r/is_columns_is_embedded.result:
  Updated results
mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result:
  Updated results
mysql-test/suite/funcs_1/r/is_tables_is_embedded.result:
  Updated results
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result:
  Updated results
mysql-test/suite/funcs_1/r/processlist_priv_ps.result:
  Updated results
mysql-test/suite/funcs_1/r/processlist_val_no_prot.result:
  Updated results
mysql-test/suite/funcs_1/r/processlist_val_ps.result:
  Updated results
mysql-test/suite/pbxt/r/pbxt_locking.result:
  Updated results
mysql-test/suite/pbxt/r/skip_name_resolve.result:
  Updated results
mysql-test/t/old-mode.test:
  Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode.
plugin/handler_socket/handlersocket/Makefile.am:
  Added -lmysqlservices
scripts/mytop.sh:
  Made 'State' field width dynamic.
  Added 'Progress' to process list display.
sql-common/client.c:
  Added handling of progress messages.
  Removed check_license() function.
sql/mysql_priv.h:
  Added opt_progress_report_time
sql/mysqld.cc:
  Added progress_report_time time variable to configure how often progress reports is sent to client
sql/protocol.cc:
  Added net_send_progress_packet()
sql/protocol.h:
  New prototypes
sql/set_var.cc:
  Added variables progress_report_time and in_transaction
sql/sql_acl.cc:
  Safety fix: Made client_capabilities ulonglong
sql/sql_class.cc:
  Added interface functions for progress reporting
sql/sql_class.h:
  Added varibles in THD for progress reporting.
  Added CF_REPORT_PROGRESS
sql/sql_load.cc:
  Added progress reporting for LOAD DATA INFILE
sql/sql_parse.cc:
  Added CF_REPORT_PROGRESS for top level commands for which it's safe to send progress reports to client
sql/sql_show.cc:
  Added Progress field last to 'show processlist'
  Stage, Max_stage and Progress field added to information_schema.progresslist
sql/sql_table.cc:
  Added progress reporting for ALTER TABLE
  Added THD as argument to copy_data_between_tables()
storage/maria/ha_maria.cc:
  Added progress reporting for check table, repair table, analyze table
  Fixed a bug in start_bulk_insert() that caused alter table to always run with all keys enabled.
storage/maria/ma_check.c:
  Added progress reporting
  Remember old state before starting repair. This removes some warnings from optimize_table if create-with-sort fails.
storage/maria/ma_check_standalone.h:
  Added dummy reporting function for standalone Aria programs.
storage/maria/ma_sort.c:
  Added progress reporting
storage/maria/maria_chk.c:
  Updated version
storage/maria/maria_def.h:
  Added new prototypes
tests/mysql_client_test.c:
  Added test case for progress reporting
2011-07-01 15:08:30 +03:00
Kent Boortz
68f00a5686 Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
44135d4725 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Michael Widenius
ba9a890f0c New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write
Split status variable Rows_read to Rows_read and Rows_tmp_read so that one can see how much real data is read.
Same was done with with Handler_update and Handler_write.
Fixed bug in MEMORY tables where some variables was counted twice.
Added new internal handler call 'ha_close()' to have one place to gather statistics.
Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()


mysql-test/r/status.result:
  Updated test results and added new tests
mysql-test/r/status_user.result:
  Udated test results
mysql-test/t/status.test:
  Added new test for temporary table status variables
sql/ha_partition.cc:
  Changed to call ha_close() instead of close()
sql/handler.cc:
  Added internal_tmp_table variable for easy checking of temporary tables.
  Added new internal handler call 'ha_close()' to have one place to gather statistics.
  Gather statistics for internal temporary tables.
sql/handler.h:
  Added handler variables internal_tmp_table, rows_tmp_read.
  Split function update_index_statistics() to two.
  Added ha_update_tmp_row() for faster tmp table handling with more statistics.
sql/item_sum.cc:
  ha_write_row() -> ha_write_tmp_row()
sql/multi_range_read.cc:
  close() -> ha_close()
sql/mysqld.cc:
  New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write
sql/opt_range.cc:
  close() -> ha_close()
sql/sql_base.cc:
  close() -> ha_close()
sql/sql_class.cc:
  Added handling of rows_tmp_read
sql/sql_class.h:
  Added new satistics variables.
  rows_read++  ->  update_rows_read() to be able to correctly count reads to internal temp tables.
  Added handler::ha_update_tmp_row()
sql/sql_connect.cc:
  Added comment
sql/sql_expression_cache.cc:
  ha_write_row() -> ha_write_tmp_row()
sql/sql_select.cc:
  close() -> ha_close()
  ha_update_row() -> ha_update_tmp_row()
sql/sql_show.cc:
  ha_write_row() -> ha_write_tmp_row()
sql/sql_table.cc:
  Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()
sql/sql_union.cc:
  ha_write_row() -> ha_write_tmp_row()
sql/sql_update.cc:
  ha_write_row() -> ha_write_tmp_row()
sql/table.cc:
  close() -> ha_close()
storage/heap/ha_heap.cc:
  Removed double counting of statistic variables.
  close -> ha_close() to get tmp table statistics.
storage/maria/ha_maria.cc:
  close -> ha_close() to get tmp table statistics.
2011-06-27 19:07:24 +03:00
Michael Widenius
2cfbfbac13 Automatic merge 2011-06-27 12:48:53 +03:00
Michael Widenius
6b2438c017 Added reading of client-server my.cnf tag 2011-06-27 12:45:03 +03:00
Sergey Petrunya
7880039fc0 Merge 5.2 -> 5.3
(testcase for #798597 now crashes)
2011-06-24 21:43:31 +04:00
Michael Widenius
424e9a888d Fixed several errors in Aria discovered by test case for lp:727869 ma_pagecache.c:2103: find_block: Assertion `block->rlocks == 0
- Fixed assert in transaction log handler when aria_check was run on block-record table that was much bigger than expected.
- Fixed warnings about wrong mutex order between bitmap and intern_lock
- Fixed error in bitmap that could cause two rows to use same block for a block record.
- Fixed wrong test that could cause error if last page for a bitmap was used by a blob.
- Fixed several bugs in pagecache for the case where pagecase had very few blocks and there was a lot of threads competing to get the blocks (very unlikely case).


mysql-test/suite/maria/r/maria-recovery3.result:
  Updated results
sql/mysqld.cc:
  Allow mi_check() to send information messages for log file
storage/maria/ma_bitmap.c:
  Fixed problem with wrong mutex order when bitmap was the first page that was flushed out of page cache
  - Fixed by introducing _ma_bitmap_mark_file_changed() that marks file changed without a bitmap lock.
  - Fixed one case in _ma_change_bitmap_page() where we didn't mark the bitmap changed. This could cause to rows to reuse same block if this was the only change to the bitmap.
  - Split _ma_bitmap_get_page_bits() in two parts to not take a bitmap lock when we already have it
  - Fixed bug in _ma_bitmap_set_full_page_bits() that caused an error if last page for a bitmap was used by a blob
storage/maria/ma_check.c:
  Better handling of wrong file length.
  Fixed bug when we tried to write to transaction log when it was not opened (happened when block record file was bigger than expected)
storage/maria/ma_pagecache.c:
  Fixed several bugs in pagecache for the case where pagecase had very few blocks and there was a lot of threads competing to get the blocks:
  - In link_block() mark a block given to another thread with PCBLOCK_REASSIGNED to ensure that no other threads can start re-using the block
    before the thread that requsted a block.
  - In free_block(), don't reset status for a block that is in re-assign by link_block() (we don't want to loose the PCBLOCK_REASSIGNED flag).
  - Added call to wait_for_flush() when we got a new block in find_block() to ensure that we don't use a block that is beeing flushed by another thread.
  - Moved setting of hits_left and last_hit_time in find_block() to where we assign the block.
  
  
  Code cleanup and making code uniform:
  - Changed a lot of KEYCACHE_DBUG_PRINT to use DBUG_PRINT
  - Streamlined all reporting of 'signal' and 'wait' between threads to be identical.
  - Use thread name instead of thread number (for each match against --debug)
  - Added more DBUG_ENTER, DBUG_PRINT and DBUG_ASSERT()
  - Added more comments
storage/myisam/ha_myisam.cc:
  Only print information about that we make a backup if we are really making a backup.
storage/myisam/mi_check.c:
  Inform mysqld that we are creating a backup of the data file (for inclusion in error log).
2011-06-24 12:08:45 +03:00
Vladislav Vaintroub
3e748505de Fix MySQL Bug #21978 : 'flush_time' value set for 1800 sec
This setting is obsolete now. It could makes sense in the past,  situations open file handles 
limit was low. It does not make sense anymore to flush all files every 1.5 hours now, after 2048 
myisam file limit is removed as fix to MySQL bug #24509.
2011-06-16 14:51:50 +02:00
Igor Babaev
078b59f5bc Merge of mwl #106 into 5.3. 2011-06-15 21:48:38 -07:00
Michael Widenius
2f6c43c5a0 Fixed warning that sf_malloc_trough_check was not used when compiling without SAFEMALLOC 2011-06-12 12:52:51 +03:00
Michael Widenius
69ffc06610 Fixes BUG#60976 "Crash, valgrind warning and memory leak with partitioned archive tables"
Noted that there was no memory leak, just a lot of used partitioned tables.
Fixed old bug: 'show status' now shows memory usage when compiled with safemalloc.
Added option --flush to mysqlcheck.c to run a 'flush tables' between each check to keep down memory usage.
Changed '--safemalloc' options to mysqld so that one can use --safemalloc and --skip-safemalloc.
Now skip-safemalloc is default (ie, we only do checking of memory overrun during free()) to speed up tests.


client/client_priv.h:
  Added OPT_FLUSH_TABLES
client/mysqlcheck.c:
  Added option --flush to mysqlcheck.c to run a 'flush tables' between each check to keep down memory usage.
mysql-test/mysql-test-run.pl:
  Always run tests with --loose-skip-safemysqld for higher speed
sql/mysqld.cc:
  Changed '--safemalloc' options so that one can use --safemalloc and --skip-safemalloc.
  Now skip-safemalloc is default (ie, we only do checking of memory overrun during free()) to speed up tests
sql/sql_parse.cc:
  Fixed old bug: 'show status' now shows memory usage when compiled with safemalloc.
storage/archive/archive_reader.c:
  Changed all malloc() calls to use my_malloc()/my_free()
  Added checks of malloc() calls.
storage/archive/ha_archive.cc:
  Detect failure if init_archive_reader() and return errno. This fixed assert crash in my_seek().
  Changed all malloc() calls to use my_malloc()/my_free()
2011-06-11 14:28:15 +03:00
Georgi Kodinov
dd49579654 Bug #12589928: MEMORY LEAK WHEN RUNNING SYS_VARS.SECURE_FILE_PRIV
This is the 5.1 version of the fix.
      
Need to free the memory allocated by the option parsing code for empty 
strings when resetting the pointer to NULL.
No test case needed, as the existing ones already cover this path.
2011-06-07 15:43:16 +03:00
Michael Widenius
2740edcf56 Fixed that mysqld --no-defaults --help --verbose doesn't give a lot of irrelevant error messages.
sql/mysql_priv.h:
  Make opt_help global
sql/mysqld.cc:
  Don't give (double) warnings about lower case file systems if --help is given.
  Don't give warning about non existing data directory if --help is given.
sql/sql_plugin.cc:
  Give a better warning if --help is used and plugin table doesn't exists
2011-06-07 10:54:37 +03:00
Georgi Kodinov
1dcd90b80b merge of mysql-5.1->mysql-5.1-security 2011-06-06 16:53:46 +03:00
Georgi Kodinov
54729bbc60 merged mysql-5.5->mysql-5.5-security 2011-06-06 16:17:58 +03:00
Georgi Kodinov
a87bf5622a merge mysql-5.1->mysql-5.5 2011-06-06 13:24:28 +03:00
Georgi Kodinov
b502a64bba Bug #11749418: 38965: TEST CASES GIS-RTREE, TYPE_FLOAT, TYPE_NEWDECIMAL
FAIL IN EMBEDDED SERVER

FreeBSD 64 bit needs the FP_X_DNML to fpsetmask() to prevent exceptions from
propagating into mysql (as a threaded application).
However fpsetmask() itself is deprecated in favor of fedisableexcept().
1. Fixed the #ifdef to check for FP_X_DNML instead of i386.
2. Added a configure.in check for fedisableexcept() and, if present,
   this function is called insted of the fpsetmask().
No need for new tests, as the existing tests cover this already.
Removed the affected tests from the experimental list.
2011-06-06 13:13:54 +03:00
Igor Babaev
3bf08e549a Added two new flags for the optimizer switch:
'derived_merge':
  - if the flag is off then all derived tables are materialized
  - if the flag is on then mergeable derived tables are merged
'derived_with_keys':
  - if the flag is off then no keys are created for derived tables
  - if the flag is on then for any derived table a key to access 
    the derived table may be created.

Now by default both flags are on.
Later the default values for the flags will be off to comply with
the current behaviour of mysql-5.1. 

Uncommented previously commented out test case from parts.partition_repair_myisam
after having added an explicit requirement to materialize the derived
table used in the test case.
2011-06-05 21:54:25 -07:00
Sergey Petrunya
9482e387e6 Change optimizer_use_mrr=auto|disable|force
to be optimizer_switch flags mrr=on|off and mrr_cost_based=on|off.
2011-06-03 00:25:58 +04:00
Michael Widenius
bf33056ef9 automatic merge with 5.2 2011-05-28 05:17:24 +03:00
Michael Widenius
f197991f41 Merge with 5.1-microseconds
A lot of small fixes and new test cases.

client/mysqlbinlog.cc:
  Cast removed
client/mysqltest.cc:
  Added missing DBUG_RETURN
include/my_pthread.h:
  set_timespec_time_nsec() now only takes one argument
mysql-test/t/date_formats.test:
  Remove --disable_ps_protocl as now also ps supports microseconds
mysys/my_uuid.c:
  Changed to use my_interval_timer() instead of my_getsystime()
mysys/waiting_threads.c:
  Changed to use my_hrtime()
sql/field.h:
  Added bool special_const_compare() for fields that may convert values before compare (like year)
sql/field_conv.cc:
  Added test to get optimal copying of identical temporal values.
sql/item.cc:
  Return that item_int is equal if it's positive, even if unsigned flag is different.
  Fixed Item_cache_str::save_in_field() to have identical null check as other similar functions
  Added proper NULL check to Item_cache_int::save_in_field()
sql/item_cmpfunc.cc:
  Don't call convert_constant_item() if there is nothing that is worth converting.
  Simplified test when years should be converted
sql/item_sum.cc:
  Mark cache values in Item_sum_hybrid as not constants to ensure they are not replaced by other cache values in compare_datetime()
sql/item_timefunc.cc:
  Changed sec_to_time() to take a my_decimal argument to ensure we don't loose any sub seconds.
  Added Item_temporal_func::get_time() (This simplifies some things)
sql/mysql_priv.h:
  Added Lazy_string_decimal()
sql/mysqld.cc:
  Added my_decimal constants max_seconds_for_time_type, time_second_part_factor
sql/table.cc:
  Changed expr_arena to be of type CONVENTIONAL_EXECUTION to ensure that we don't loose any items that are created by fix_fields()
sql/tztime.cc:
  TIME_to_gmt_sec() now sets *in_dst_time_gap in case of errors
  This is needed to be able to detect if timestamp is 0
storage/maria/lockman.c:
  Changed from my_getsystime() to set_timespec_time_nsec()
storage/maria/ma_loghandler.c:
  Changed from my_getsystime() to my_hrtime()
storage/maria/ma_recovery.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/maria/unittest/trnman-t.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/xtradb/handler/ha_innodb.cc:
  Added support for new time,datetime and timestamp
unittest/mysys/thr_template.c:
  my_getsystime() -> my_interval_timer()
unittest/mysys/waiting_threads-t.c:
  my_getsystime() -> my_interval_timer()
2011-05-28 05:11:32 +03:00
Sven Sandberg
add86aaddc Merged BUG#12574820 from 5.1 to 5.5
Two conflicts resolved manually:
Text conflict in sql/log.cc
Text conflict in sql/mysqld.cc
2011-05-26 12:56:17 +02:00
Sven Sandberg
de3776819c BUG#12574820: binlog.binlog_tmp_table timing out in daily and weekly trunk run
Problem: MYSQL_BIN_LOG::reset_logs acquires mutexes in wrong order.
The correct order is first LOCK_thread_count and then LOCK_log. This function
does it the other way around. This leads to deadlock when run in parallel
with a thread that takes the two locks in correct order. For example, a thread
that disconnects will take the locks in the correct order.
Fix: change order of the locks in MYSQL_BIN_LOG::reset_logs:
first LOCK_thread_count and then LOCK_log.


mysql-test/suite/binlog/r/binlog_reset_master.result:
  added result file
mysql-test/suite/binlog/t/binlog_reset_master.test:
  Added test case that demonstrates deadlock because of wrong mutex order.
  The deadlock is between two threads:
   - RESET MASTER acquires mutexes in wrong order.
   - client thread shutdown code acquires mutexes in right order.
  Actually, this test case does not produce deadlock in 5.1, probably
  the client thread shutdown code does not hold both mutexes at the same
  time. However, the bug existed in 5.1 (mutexes are taken in the wrong
  order) so we push the test case to 5.1 too, to prevent future
  regressions.
sql/log.cc:
  Change mutex acquisition to the correct order:
  first LOCK_thread_count, then LOCK_log.
sql/mysqld.cc:
  Add debug code to synchronize test case.
2011-05-26 12:50:43 +02:00
Vladislav Vaintroub
decb9c639a Fixed sql_perror() to return appropriate error messages on Windows,
The error message is now based on GetLastError() rather than errno. 

Background: errno is C runtime specific and in many circumstances 
it is not set, e.g when using Win32 API or socket functions.
2011-05-26 02:01:47 +02:00
Vladislav Vaintroub
79afbf7646 On Windows, collect mysql error log with Windows Error Reporting.
This simplifies postmortem analysis for crashes reported via Winqual.
2011-05-26 00:37:08 +02:00
Mikael Ronström
f125f2994f BUG#12578441, reintroduced thd->cleanup() in unlink_thd, removed by mistake, added private interface to this function 2011-05-25 12:17:27 +02:00
Sergei Golubchik
03b33425e5 many changes to my_getsystime.c:
* my_getsystime() is only an interval timer. Its value can beused for calculating
  time intervals.
* renamed my_getsystime() to my_interval_timer(), to make the semantics
  clearer and let the compiler catch wrong usages of my_getsystime()
  (also future ones, that may come in merges).
* increased its granularity from 100ns to 1ns, old value was for UUID,
  but as UUID can no longer use it directly there is no need to downgrade
  the OS provided value
* fixed the UUID code to anchor the my_interval_timer() on the epoch, as
  required by the UUID standard. That is, this was only needed by UUID,
  and now I've moved it to UUID code from my_getsystime().
* fixed other wrong usages of my_getsystime() - e.g. in calculating
  times for pthread_cond_timedwait. It was buggy and could've caused
  long waits if OS clock would be changed.
2011-05-19 19:05:35 +02:00
unknown
1177bea2f1 Rewritten patch of percona - switching query cache on and off, removing comments.
client/mysqltest.cc:
  Column names.
mysql-test/r/grant_cache_no_prot.result:
  fix of text.
mysql-test/r/grant_cache_ps_prot.result:
  Fix of test.
mysql-test/r/query_cache.result:
  Switching on and off query cache.
mysql-test/t/query_cache.test:
  Switching on and off query cache.
mysys/charset.c:
  Fix of parser.
sql/handler.cc:
  thd added to parameters.
sql/log_event.cc:
  thd added to parameters.
sql/log_event_old.cc:
  thd added to parameters.
sql/mysql_priv.h:
  Fixed functions definitions.
sql/mysqld.cc:
  Comments stripping.
sql/set_var.cc:
  Switching on and off query cache.
sql/set_var.h:
  Switching on and off query cache.
sql/share/errmsg.txt:
  New errors.
sql/sql_cache.cc:
  Switching query cache on and off, removing comments.
sql/sql_cache.h:
  thd added to parameters.
sql/sql_class.h:
  Comments stripping.
sql/sql_db.cc:
  thd added to parameters.
sql/sql_lex.cc:
  lex fixed.
sql/sql_parse.cc:
  thd added to parameters.
2011-05-18 16:27:19 +03:00
Mikael Ronström
a922909a89 merge 2011-05-18 11:37:10 +02:00
Mikael Ronström
89ec54264d Split up unlink_thd in several functions 2011-05-18 09:38:05 +02:00
Georgi Kodinov
db95a75a48 merge mysql-5.1->mysql-5.5 2011-07-01 17:22:38 +03:00
Michael Widenius
8543621fa0 Merge with 5.3 main 2011-05-16 15:07:04 +03:00
Mikael Ronstrom
e2602f4eab Removed variables no longer needed in plugins, moved to methods instead 2011-05-13 15:46:35 +02:00
Michael Widenius
f09f1c7c7d Merge with dynamic column code 2011-05-12 14:30:34 +03:00
Michael Widenius
8d52c2cffe Fixed compiler warnings and test cases problems found by buildbot
mysql-test/r/dyncol.result:
  Updated test results
mysql-test/r/index_intersect.result:
  Updated results
mysql-test/r/index_intersect_innodb.result:
  Updated results
mysql-test/t/dyncol.test:
  Added replace_result for floating point results that are different on windows
  Added round() around a result to get same result on all platforms.
mysql-test/t/index_intersect.test:
  Added replace_result to fix that index_merge may put key names in different order.
mysys/ma_dyncol.c:
  Fixed compiler warnings on Solaris
sql/key.cc:
  Fixed compiler warnings on Solaris
sql/mysqld.cc:
  Fixed compiler warning on windows
support-files/compiler_warnings.supp:
  Suppressed an unintersting warning on Solaris
2011-05-11 13:59:17 +03:00
unknown
a55b1165d2 MWL#89 - Automatic merge with 5.3 2011-05-10 18:28:05 +03:00
Michael Widenius
f34be18938 Merge with MariaDB 5.2 2011-05-10 18:17:43 +03:00
Georgi Kodinov
c4c808d606 weave merge of mysql-5.5->mysql-5.5-security 2011-05-10 17:20:26 +03:00
Vladislav Vaintroub
ba87d4810a Fix effect of recent mismerge (it made default pid file name ".pid" instead of "hostname.pid") 2011-05-07 19:27:07 +02:00
Georgi Kodinov
858cf12f89 Addendum 3 for bug #BUG#11764517 : expand secure_file_priv to the real
patch so that it can later be compared with patchs with expanded symlinks
2011-05-05 12:10:49 +03:00
Georgi Kodinov
2da8ba6404 merge mysql-5.1-security->mysql-5.5-security 2011-05-04 15:59:00 +03:00
Georgi Kodinov
e76cd16967 Merged 5.0-security->5.1-security 2011-05-04 14:29:23 +03:00
Michael Widenius
1be5462d59 Merge with MariaDB 5.1 2011-05-03 19:10:10 +03:00
unknown
284f52476c Merge MWL#180, binlog checksum backport, into MariaDB 5.3-based tree. 2011-05-03 14:44:25 +02:00
unknown
014b8e7f43 Backport MySQL WL#2540 into MariaDB.
Patch backported:

bzr diff
'-rrevid:alfranio.correia@oracle.com-20101121143257-se3vpqus73l4mum0
..revid:luis.soares@oracle.com-20101124111752-9b8260bd1qak87hr'
--old=lp:mysql-server --new=lp:mysql-server
2011-05-03 14:01:11 +02:00
unknown
5dc11616b2 MWL#89
Merge with 5.3
2011-05-02 21:59:16 +03:00
Michael Widenius
e415ba0fb2 Merge with MySQL 5.1.57/58
Moved some BSD string functions from Unireg
2011-05-02 20:58:45 +03:00
Michael Widenius
046418ad95 Added calls to cleanup_mutexes() for embedded library. 2011-04-28 23:58:00 +03:00
Georgi Kodinov
59d7516005 Bug #11764517: 57359: POSSIBLE TO CIRCUMVENT SECURE_FILE_PRIV
USING '..' ON WINDOWS

Backport of the fix to 5.0 (to be null-merged to 5.1).
Moved the test into the main test suite. 
Made mysql-test-run.pl to not use symlinks for sdtdata as the symlinks
are now properly recognized by secure_file_priv.
Made sure the paths in load_file(), LOAD DATA and SELECT .. INTO OUTFILE 
that are checked against secure_file_priv in a correct way similarly to 5.1 
by the extended is_secure_file_path() backport before the comparison.
Added an extensive test with all the variants of upper/lower case, 
slash/backslash and case sensitivity.
Added few comments to the code.
2011-04-28 12:22:41 +03:00
Sergei Golubchik
0accbd0364 lots of post-merge changes 2011-04-25 17:22:25 +02:00
Mikael Ronström
70ed67e1cc Merge 5.5 2011-04-15 15:46:11 +02:00
Davi Arnaut
8aadfb4065 Remove some leftovers from the removal of the gethostbyname wrappers. 2011-04-13 16:05:26 -03:00
unknown
64e43e1cc8 Merge various replication-related patches into MariaDB 5.3:
- MWL#116 Group commit
 - MWL#136 Enhancements for START TRANSACTION WITH CONSISTENT SNAPSHOT
 - MWL#47 Annotate_rows_log_event
 - MWL#163 innodb_release_locks_early
 - Percona patch enhancing row-based replication for tables with no primary key
2011-04-08 09:39:33 +02:00
unknown
c677fea7d0 Merge MariaDB 5.2.5 release into MariaDB-5.2-rpl. 2011-04-01 15:07:10 +02:00
unknown
619a16bffc MWL#89
- Auto-merge with 5.3 main.
- Changed the test for LP BUG#719198 so that
  an two more queries were added, and removed a
  query that produces a wrong result due to an
  unrelated problem. The wrong result is submitted
  as a separate bug.
2011-04-01 15:42:59 +03:00
Michael Widenius
309e016eec Fixes to get more information about random bind failure in pushbuild for windows hosts.
mysql-test/mysql-test-run.pl:
  Set port-open-timeout to 10 to retry binds
sql/mysqld.cc:
  Write error number for bind failure. (perror can't do that on windows as errno dosn't contain error code)
2011-03-30 12:15:58 +03:00
unknown
3d8aa98c71 MWL#89
Merge 5.3 with 5.3-mwl89.
2011-03-30 11:38:57 +03:00
unknown
952556b345 MWL#89
Merge 5.3 with 5.3-mwl89.
2011-03-30 10:10:59 +03:00
Vladislav Vaintroub
262dd32045 merge 2011-03-28 12:57:52 +02:00
Michael Widenius
b20efbb119 Fixed test failures with embedded server
mysql-test/mysql-test-run.pl:
  Don't set --log-error when running embedded server as we don't want the mysqltest output into mysqld.1.err
sql/mysqld.cc:
  Allow one to disable --log-error
2011-03-28 12:49:20 +03:00
Vladislav Vaintroub
493a9108ae merge 2011-03-26 00:15:33 +01:00
Georgi Kodinov
0d01bcca9d Merged bug #11766769 to 5.5.
Added back the specific warning number.
2011-03-25 14:55:22 +02:00
Georgi Kodinov
dcf6b68d08 Bug #11766769: 59959: SMALL VALUES OF --MAX-ALLOWED-PACKET
ARE NOT BEING HONORED

max_allowed_packet works in conjunction with net_buffer_length.
max_allowed_packet is an upper bound of net_buffer_length.
So it doesn't make sense to set the upper limit lower than the value.
Added a warning (using ER_UNKNOWN_ERRROR and a specific message)
when this is done (in the log at startup and when setting either 
max_allowed_packet or the net_buffer_length variables)
Added a test case.
Fixed several tests that broke the above rule.
2011-03-25 12:57:27 +02:00
Michael Widenius
7de98f2ffb Added --log-basename to mysqld to allow one to set the prefix for all logs with one command
Changed test suite to use --log-basename (to get the code tested)
Added --sync-sys=1 to test suite to speed it up.
Better error messages if something goes wrong with mysql_install_db


mysql-test/Makefile.am:
  Removed not existing directory
mysql-test/lib/My/ConfigFactory.pm:
  Use log-basename
  We had to also set 'log_error' as some test was explicitely using the old name
  Added 'sync-sys=1' to speed up test suite
mysql-test/r/variables-notembedded.result:
  Updated test results (variable relay_log is now set)
mysql-test/suite/binlog/t/binlog_delete_and_flush_index-master.opt:
  Force specific names for some log files.
mysql-test/suite/binlog/t/binlog_index-master.opt:
  Force specific names for some log files.
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt:
  Force specific names for some log files.
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test:
  Better error message if something goes wrong
mysql-test/suite/rpl/r/rpl_flushlog_loop.result:
  Updated results
mysql-test/suite/rpl/rpl_1slave_base.cnf:
  Use --log-basename
scripts/mysql_install_db.sh:
  More information to --help
  Write url to knowledge base if something goes wrong
  Fail at once if we can't create a database directory (no reason to continue and write a screenful of not related text)
scripts/mysqld_safe.sh:
  Also allow one to use --data for --datadir (common shortening)
  Added support for --log-basename
  Fail at once if we can't create a log directory
  Fixed bug where we used a pid file name without '.pid' extension
sql/log.cc:
  Create a log file name trough my_once_alloc()  (To get it automaticly freed at exit)
sql/mysql_priv.h:
  Added new prototype
sql/mysqld.cc:
  Added support for --log-basename
  Better help for a lot of log-filename related variables.
sql/rpl_rli.cc:
  Write information that one can use --log-basename
sql/set_var.cc:
  Add log_basename as a readonly variable
2011-03-23 17:59:41 +02:00
Dmitry Shulga
feb6d22328 Manual merge from mysql-5.1 for Bug#11764168 (56976: Severe denial
of service in prepared statements).

sql/sql_prepare.cc:
  At mysql_stmt_get_longdata(): instead of pushing an internal
  error handler (as done in 5.1-tree) we save, set and restore
  the statement's diagnostics area and warning info.
2011-03-15 18:57:36 +06:00
Dmitry Shulga
9320dca994 Fixed Bug#11764168 "56976: SEVERE DENIAL OF SERVICE IN PREPARED STATEMENTS".
The problem was that server didn't check resulting size of prepared
statement argument which was set using mysql_send_long_data() API.
By calling mysql_send_long_data() several times it was possible
to create overly big string and thus force server to allocate
memory for it. There was no way to limit this allocation.

The solution is to add check for size of result string against
value of max_long_data_size start-up parameter. When intermediate
string exceeds max_long_data_size value an appropriate error message
is emitted.

We can't use existing max_allowed_packet parameter for this purpose
since its value is limited by 1GB and therefore using it as a limit
for data set through mysql_send_long_data() API would have been an
incompatible change. Newly introduced max_long_data_size parameter
gets value from max_allowed_packet parameter unless its value is
specified explicitly. This new parameter is marked as deprecated
and will be eventually replaced by max_allowed_packet parameter.
Value of max_long_data_size parameter can be set only at server
startup.


mysql-test/t/variables.test:
  Added checking for new start-up parameter max_long_data_size.
sql/item.cc:
  Added call to my_message() when accumulated string exceeds
  max_long_data_size value. my_message() calls error handler
  that was installed in mysql_stmt_get_longdata before call
  to Item_param::set_longdata.
  
  The error handler then sets state, last_error and last_errno
  fields for current statement to values which correspond to
  error which was caught.
sql/mysql_priv.h:
  Added max_long_data_size variable declaration.
sql/mysqld.cc:
  Added support for start-up parameter 'max_long_data_size'.
  This parameter limits size of data which can be sent from
  client to server using mysql_send_long_data() API.
sql/set_var.cc:
  Added variable 'max_long_data_size' into list of variables
  displayed by command 'show variables'.
sql/sql_prepare.cc:
  Added error handler class Set_longdata_error_handler.
  This handler is used to catch any errors that can be
  generated during execution of Item_param::set_longdata().
  
  Source code snippet that makes checking for statement's state 
  during statement execution is moved from Prepared_statement::execute()
  to Prepared_statement::execute_loop() in order not to call
  set_parameters() when statement has failed during
  set_long_data() execution. If this hadn't been done
  the call to set_parameters() would have failed.
tests/mysql_client_test.c:
  A testcase for the bug #56976 was added.
2011-03-15 17:36:12 +06:00
Magne Mahre
cf2af2bd6f Bug#11858960 - WINDOWS SERVICE FAILING TO START IMMEDIATELY AFTER
INSTALLATION

When starting mysqld as an MS Windows NT service, it crashed 
with "Error 1067: The process terminated unexpectedly".

The problem is that thread local variables are not allocated
and initialized properly when started as a service. When the
server is started as a regular executable, the problem does
not occur.

Analysis showed that this is a regression after the patch for 
Bug#11765237/Bug#11763065.   Before, the thread local storage
was initialized by the call chain:
win_main->my_basic_init->my_thread_basic_global_init->
my_thread_init

When the my_init() structure was changed, this initialization
was moved from win_main to mysqld_main.   When started as
a service win_main is run in a separate thread, which does
not have mysqld_main in its call path, so my_thread_init
is never called for this thread.

Added a call to my_thread_init / my_thread_end in the service
handler function, which solves the problem.
2011-03-14 14:03:48 +01:00
Marc Alff
3f2d2fe7b5 Local merge 2011-03-10 09:43:55 +01:00
Michael Widenius
139a2b64bf Merge with 5.2 2011-03-09 15:47:59 +02:00
Mikael Ronstrom
0fc7078e53 merge 2011-03-04 12:35:24 +01:00
Michael Widenius
e1bb14ea6b Automatic merge with 5.2 to fix compiler failure on FreeBSD 2011-03-04 12:39:27 +02:00
Michael Widenius
fa4eb9931b Removed wrong #ifdef that caused compile failure on Freebsd. 2011-03-04 12:37:48 +02:00
Marc Alff
5ee9001844 Bug#11766528 PERFORMANCE_SCHEMA TRACKS BOTH BINARY AND RELAY LOGS IN THE SAME EVENTS
Before this fix, all the performance schema instrumentation for both the binary log
and the relay log would use the following instruments:
- wait/io/file/sql/binlog
- wait/io/file/sql/binlog_index
- wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index
- wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond

This instrumentation is too general and can be more specific.

With this fix, the binlog instrumentation is identical,
and the relay log instrumentation is changed to:
- wait/io/file/sql/relaylog
- wait/io/file/sql/relaylog_index
- wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index
- wait/synch/cond/sql/MYSQL_RELAY_LOG::update_cond

With this change, the performance instrumentation for the binary log and the relay log,
which share the same structure but have different uses, is more detailed.
This is especially important for hosts in the middle of a replication chain,
that are both masters (binlog) and slaves (relaylog).
2011-03-01 17:39:28 +01:00
unknown
71e9d94895 MWL#89
Merge 5.3 into 5.3-mwl89.
2011-03-01 15:54:21 +02:00
Sergei Golubchik
a8a757c6bb wl#173 - temporal types with sub-second resolution
and collateral changes.

* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
  never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
  MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double

client/mysqlbinlog.cc:
  remove unneded casts
include/my_sys.h:
  introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
  pack_time/unpack_time, etc.
  convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
  str_to_time() is gone. str_to_datetime() does it now.
  my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
  time is not equal to datetime anymore
mysql-test/r/distinct.result:
  a test for an old MySQL bug
mysql-test/r/explain.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
  when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
  ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
  new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
  TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
  invalid datetime is not compared with as a string
mysql-test/r/select.result:
  NO_ZERO_IN_DATE, etc only affect storage - according to the manual
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
  when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
  TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
  old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
  test for an old MySQL bug
mysql-test/t/func_time.test:
  +- INTERVAL now works with TIME values
mysql-test/t/select.test:
  typo
mysql-test/t/subselect.test:
  only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
  old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
  old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
  old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
  old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
  old timestamp(X) is no longer supported
mysys/my_getsystime.c:
  functions to get the time with microsecond precision
mysys/my_init.c:
  move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
  no need to make these variables extern
mysys/my_static.h:
  no need to make these variables extern
scripts/mysql_system_tables.sql:
  old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
  old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
  old timestamp(X) is no longer supported
sql-common/my_time.c:
  * call str_to_time from str_to_datetime, as appropriate
  * date/time to string conversions take precision as an argument
  * number_to_time()
  * TIME_to_double()
  * pack_time() and unpack_time()
sql/event_data_objects.cc:
  cast is not needed
  my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
  avoid dangerous downcast (because the pointer is
  not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
  avoid silly double-work for cond_wait
  (having an endpoint of wait, subtract the current time to get the timeout,
  and use set_timespec() macro to fill in struct timespec, by adding the current
  time to the timeout)
sql/field.cc:
  * remove virtual Field::get_time(), everyone should use only Field::get_date()
  * remove lots of #ifdef WORDS_BIGENDIAN
  * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
  * Field_timestamp_hires, Field_datetime_hires, Field_time_hires
  * Field_temporal
  * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
  * remove virtual Field::get_time(), everyone should use only Field::get_date()
  * remove lots of #ifdef WORDS_BIGENDIAN
  * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
  * Field_timestamp_hires, Field_datetime_hires, Field_time_hires
  * Field_temporal
  * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
  * removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
  TIME_RESULT, cmp_time()
sql/item.cc:
  * numbers aren't quoted in EXPLAIN EXTENDED
  * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
  * virtual Item::get_time() is gone
  * Item_param::field_type() is set correctly
  * Item_datetime, for a datetime constant
  * time to anything is compared as a time
  * Item_cache::print() prints the value is available
  * bug fixed in Item_cache_int::val_str()
sql/item.h:
  * Item::print_value(), to be used from Item_xxx::print() when needed
  * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
  * virtual Item::get_time() is gone
  * Item_datetime, for a datetime constant
  * better default for cast_to_int_type()
  * Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
  * get_year_value, get_time_value are gone. get_datetime_value does it all
  * get_value_a_func, get_value_b_func are gone
  * can_compare_as_dates() is gone too, TIME_RESULT is used instead
  * cmp_type() instead or result_type() when doing a comparison
  * compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
  * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
  greatly simplified Arg_comparator
sql/item_create.cc:
  * fix a bug in error messages in CAST
sql/item_func.cc:
  Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
  mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
  overwrite the default cmp_type() for Item_row,
  as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
  rewrite make_datetime to support precision argument
  SEC_TO_TIME is real function, not integer.
  many functions that returned temporal values had duplicate code in val_* methods,
  some of them did not have get_date() which resulted in unnecessary date->str->date conversions. 
  Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
  many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
  SEC_TO_TIME is real function, not integer.
  many functions that returned temporal values had duplicate code in val_* methods,
  some of them did not have get_date() which resulted in unnecessary date->str->date conversions. 
  Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
  many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
  replication of NOW(6)
sql/log_event.h:
  replication of NOW(6)
sql/mysql_priv.h:
  Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
  make_truncated_value_warning() that uses it.
sql/mysqld.cc:
  datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
  cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
  Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
  Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
  small cleanup
sql/set_var.cc:
  SET TIMESTAMP=double
sql/set_var.h:
  @@TIMESTAMP is a double
sql/share/errmsg.txt:
  precision and scale are unsigned
sql/slave.cc:
  replication of NOW(6)
sql/sp_head.cc:
  cleanup
sql/sql_class.cc:
  support for NOW(6)
sql/sql_class.h:
  support for NOW(6)
sql/sql_insert.cc:
  support for NOW(6)
sql/sql_select.cc:
  use item->cmp_type().
  move a comment where it belongs
sql/sql_show.cc:
  new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
  TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
  fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
  TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
  warnings
tests/mysql_client_test.c:
  old timestamp(X) does not work anymore
  datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
unknown
7895c35874 MWL#89
Merge MWL#89 with 5.3.
2011-03-01 14:16:28 +02:00
Magne Mahre
c4715a8076 Bug#11765237 - 58179: CANNOT START MYSQLD WITH APP VERIFIER
Bug#11763065 - 55730: KILL_SERVER() CALLS SETEVENT ON A NULL 
               HANDLE, SMEM_EVENT_CONNECT_REQUEST
      
Application Verifier is a Microsoft tool used for
detecting certain classes of programming errors.
In particular, MS Windows OS resource usage is
monitored for wrong usage (handles, thread local
storage, critical sections, ...)
      
In MySQL 5.5.x, an error was introduced where an
object on thread local storage was used before the
TLS and the object was created.
      
The fix has been to move the mysys initialization
to an earlier stage in the boot process when built for
Windows.  For non-win builds, the init already happens
early.

Some un-tangling of calls to my_init(), my_basic_init()
and my_thread_global_init() was done.  There is no
longer a need to do init in steps, so the full my_init()
is called instead of my_init_basic().
      
In addition,  Bug#11763065 was fixed.  The event handle
'smem_event_connect_request' is only created if
'opt_enable_shared_memory' is set.  When killing the
server, an event was flagged on the handle
unconditionally.  Added a test, so it will only be
flagged if created.


include/my_pthread.h:
  my_thread_basic_global_init is no longer
  necessary, and the my_thread_basic_global_reinit 
  function is renamed to reflect that it now
  reinits mutexes and condvars originating from
  my_thread_global_init
mysys/my_thr_init.c:
  Reorganized code.
2011-03-01 13:03:31 +01:00
Michael Widenius
3358cdd504 Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
Igor Babaev
1b03a028fc Merge. 2011-02-27 10:14:11 -08:00
Igor Babaev
ed3524c212 Minor corrections.
sql/mysqld.cc:
  Fixed: optimize_join_buffer_size was missing in the description of possible
  options for the optimizer switch.
sql/sql_select.cc:
  Fixed: initialization for the field ref_table_rows of the KEYUSE structure was 
  missing (as a result of a lame merge).
2011-02-27 09:35:14 -08:00
Michael Widenius
4ad6d6b6c9 Merge in new handler and handlersocket code into 5.3 main 2011-02-22 11:15:47 +02:00
Michael Widenius
58bb0769bd Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria"
- Fixed wrong assert in Aria

Now need to merge with latest xtradb before pushing 

sql/ha_partition.cc:
  Ensure that m_ordered_rec_buffer is not freed before close.
sql/mysqld.cc:
  Changed to use opt_stack_trace instead of opt_pstack.
  Removed references to pstack
sql/partition_element.h:
  Ensure that connect_string is initialized
storage/maria/ma_key_recover.c:
  Fixed wrong assert
2011-02-20 18:51:43 +02:00
Mikael Ronström
715d404eea More work on interfaces 2011-02-16 20:38:35 +01:00
Sven Sandberg
2f9198a0f2 WL#5670: Proposal: Remove SHOW NEW MASTER statement
Removes SHOW NEW MASTER statement and all related code.
Also removes the unused function update_slave_list from repl_failsafe.cc.


mysql-test/r/signal_code.result:
  Updated result file.
  The output of SHOW PROCEDURE CODE has changed, because the numerical values
  of some SQLCOM_ commands have changes. This is not a problem, because
  SHOW PROCEDURE CODE only exists in debug builds and the numerical values of
  SQLCOM_ constants are not exposed elsewhere.
mysql-test/r/sp-code.result:
  Updated result file.
  The output of SHOW PROCEDURE CODE has changed, because the numerical values
  of some SQLCOM_ commands have changes. This is not a problem, because
  SHOW PROCEDURE CODE only exists in debug builds and the numerical values of
  SQLCOM_ constants are not exposed elsewhere.
sql/mysqld.cc:
  Remove SQLCOM_SHOW_NEW_MASTER.
sql/repl_failsafe.cc:
  Remove show_new_master, which was only used by the removed SHOW NEW MASTER statement.
  Remove translate_master, which was only used by show_new_master.
  Remove find_slave_event, which was only used by translate_master.
  Remove find_target_pos, which was only used by translate_master.
  Remove cmp_master_pos, which was only used by translate_master.
  Remove update_slave_list, which was not used at all.
sql/repl_failsafe.h:
  Remove declarations of functions removed by this patch:
    update_slave_list, show_new_master, translate_master, update_slave_list
  
  Remove declarations of functions that did not exist before this patch:
    handle_failsafe_rpl, load_master_data
  
  Remove declaration of function that is static in slave.cc:
    connect_to_master
sql/sp_head.cc:
  Removed SQLCOM_SHOW_NEW_MASTER
sql/sql_lex.h:
  Removed SQLCOM_SHOW_NEW_MASTER
sql/sql_parse.cc:
  Removed SQLCOM_SHOW_NEW_MASTER
sql/sql_repl.cc:
  Removed cmp_master_pos(char*,ulonglong,char*,ulonglong), which was
  only used by cmp_master_pos*Slave_log_event* sev, LEX_MASTER_INFO* mi) in repl_failsafe.cc,
  which has been removed.
sql/sql_repl.h:
  removed cmp_master_pos
sql/sql_yacc.yy:
  removed syntax SHOW NEW MASTER.
2011-02-16 17:27:35 +01:00
Mikael Ronström
e3f89e5dba merge 2011-02-10 18:15:19 +01:00
Igor Babaev
4b24105df8 Introduced optimizer switch flag 'optimize_join_buffer_size'.
When this flag is 'off' the size of the used join buffer 
is taken directly from the system variable 'join_buffer_size'.
When this flag is 'on' then the size of the buffer depends
on the estimated number of rows in the partial join whose
records are to be stored in the buffer.
By default this flag is set 'on'.
2011-02-04 19:06:35 -08:00
Dmitry Shulga
378091e434 Fixed bug#58026 - massive recursion and crash in regular expression
handling.

The problem was that parsing of nested regular expression involved
recursive calls. Such recursion didn't take into account the amount of
available stack space, which ended up leading to stack overflow crashes.

mysql-test/t/not_embedded_server.test:
  Added test for bug#58026.
regex/my_regex.h:
  added pointer to function as last argument of my_regex_init() for check
  enough memory in stack.
regex/regcomp.c:
  p_ere() was modified: added call to function for check enough memory
  in stack. Function for check available stack space specified by
  global variable my_regex_enough_mem_in_stack. This variable set to
  NULL for embedded mysqld and to a pointer to function
  check_enough_stack_size otherwise.
regex/reginit.c:
  my_regex_init was modified: pass a pointer to a function for check
  enough memory in stack space. Reset this pointer to NULL in my_regex_end.
sql/mysqld.cc:
  Added function check_enough_stack_size() for check enough memory in stack.
  Passed this function as second argument to my_regex_init. For embedded 
  mysqld passed NULL as second argument.
2011-02-04 10:47:46 +06:00
Mikael Ronström
fbbe9c2e8e Fixed such that debug_sync can be used by plugins on Windows 2011-02-03 21:05:34 +01:00
Michael Widenius
cfa0c6ff1d Increased precision for status variables Rows_sent and Rows_read from long to longlong
Fixed that status variables 'empty_queries', 'access_denied_errors' and 'lost_connections' are propageted to global status.
This should also remove some warnings with VC++



sql/mysqld.cc:
  Increased precision for status variables Rows_sent and Rows_read from long to longlong
sql/sql_class.cc:
  Increased precision for status variables Rows_sent and Rows_read from long to longlong
sql/sql_class.h:
  Increased precision for status variables Rows_sent and Rows_read from long to longlong
  Fixed that status variables 'empty_queries', 'access_denied_errors' and 'lost_connections' are propageted to global status.
2011-02-03 16:45:29 +02:00
Georgi Kodinov
72ae1d65dd merge to 5.1. 2011-02-02 19:05:28 +02:00
Georgi Kodinov
a70c34bf0f Fixes for Bug #55755 and Bug #52315 part 2
Bug #55755 : Date STD variable signness breaks server on FreeBSD and OpenBSD

* Added a check to configure on the size of time_t
* Created a macro to check for a valid time_t that is safe to use with datetime 
  functions and store in TIMESTAMP columns.
* Used the macro consistently instead of the ad-hoc checks introduced by 52315
* Fixed compliation warnings on platforms where the size of time_t is smaller than
  the size of a long (e.g. OpenBSD 4.8 64 amd64).

Bug #52315: utc_date() crashes when system time > year 2037

* Added a correct check for the timestamp range instead of just variable size check to
SET TIMESTAMP.
* Added overflow checking before converting to time_t. 
* Using a correct localized error message in this case instead of the generic error.
* Added a test suite.
* fixed the checks so that they check for unsigned time_t as well. Used the checks 
  consistently across the source code.
* fixed the original test case to expect the new error code.
2011-02-02 18:51:35 +02:00
unknown
6dbd796074 Merge three Percona patches into mariadb-5.2-rpl:
- MWL#47, allowing to annotate row-based binlog events with the SQL test of
   the originating query (eg. in mysqlbinlog output).

 - row_based_replication_without_primary_key.patch, providing more intelligent
   selection of index to use on slave when applying row-based binlog events
   for tables with no primary key.

 - Make mysqlbinlog omit redundant `use` around BEGIN/SAVEPOINT/COMMIT/
   ROLLBACK in 5.0 binlogs.
2011-01-26 15:35:03 +01:00
Mikael Ronstrom
416b7144d5 BUG#59549, Fix compiler errors on Windows, step 5 2011-01-24 14:57:07 +01:00
Dmitry Shulga
4e9e30434e Merge from mysql-5.1 for bug#58026. 2011-02-04 10:59:55 +06:00
Georgi Kodinov
fe145b0900 merge 2011-02-02 20:13:28 +02:00
unknown
b0be3e2c68 Merge MWL#89 into 5.3 main. 2011-01-11 14:04:08 +02:00
unknown
32379aeba9 Merge Percona patch MWL#47 into mariadb 5.2-percona.
This patch adds options to annotate the binlog (and the mysqlbinlog
output) with the original SQL query for queries that are logged
using row-based replication.
2011-01-10 14:53:09 +01:00
He Zhenxing
c5aa3313aa BUG#57953 my_load_defaults return junk argument ----args-separator---- to caller
After fix of bug#25192, load_defaults() will add an args separator
to distinguish options loaded from configure files from that provided
in the command line. One problem of this is that the args separator
would be added no matter the application need it or not.

Fixed the problem by adding an option:
  bool my_getopt_use_args_separator;
to control whether the separator will be added or not. And also
added functions:
  bool my_getopt_is_args_separator(const char* arg);
to check if the argument is the separator or not.
2011-01-17 15:44:37 +08:00
Guilhem Bichot
745a9f92ec Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)"
mysql-test/r/mysqld--help-notwin.result:
  consequence of introducing opt_autocommit and its default
mysql-test/suite/sys_vars/r/autocommit_func4.result:
  Before this fix, this test would have shown @@global.autocommit == 0
  in spite of --autocommit=on.
mysql-test/suite/sys_vars/r/autocommit_func5.result:
  result unchanged by the fix
sql/mysqld.cc:
  atoi(argument) was reliable for =0|1 parameters. Now that boolean options
  must support =on/off/true/false, atoi(argument) is wrong (being always 0
  for those strings). Instead, let the internal logic of my_getopt
  (in particular get_bool_argument()) set a boolean opt_autocommit
  properly, and use that to set global_system_variables.option_bits.
2011-01-14 14:21:46 +01:00
Michael Widenius
e63b5546c5 Implementation of MWL#172: Add support for prepared statements to HANDLER READ
It includes speed optimizations for HANDLER READ by caching as much as possible in HANDLER OPEN
Other things:
- Added mysqld option --disable-thr-alarm to be able to benchmark things without thr_alarm
- Changed 'Locked' state to 'System lock' and 'Table lock' (these where used in the code but never shown to end user)
- Better error message if mysql_install_db.sh fails
- Moved handler function prototypes to sql_handler.h
- Remove not anymore used 'thd->locked' member


include/thr_alarm.h:
  Added my_disable_thr_alarm
include/thr_lock.h:
  Add new member to THR_LOCK_DATA to remember original lock type state. This is needed as thr_unlock() resets type to TL_UNLOCK.
mysql-test/include/check_no_concurrent_insert.inc:
  Locked -> Table lock
mysql-test/include/handler.inc:
  Locked -> Table lock
mysql-test/r/handler_innodb.result:
  Updated results for new tests
mysql-test/r/handler_myisam.result:
  Updated results for new tests
mysql-test/r/sp-threads.result:
  Locked -> Table lock
mysql-test/suite/binlog/t/binlog_stm_row.test:
  Locked -> Table lock
mysql-test/suite/funcs_1/datadict/processlist_val.inc:
  Locked -> Table lock
mysql-test/suite/pbxt/t/lock_multi.test:
  Locked -> Table lock
mysql-test/suite/sys_vars/r/concurrent_insert_func.result:
  Locked -> Table lock
mysql-test/suite/sys_vars/t/concurrent_insert_func.test:
  Locked -> Table lock
mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test:
  Locked -> Table lock
mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test:
  Locked -> Table lock
mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test:
  Locked -> Table lock
mysql-test/t/insert_notembedded.test:
  Locked -> Table lock
mysql-test/t/lock_multi.test:
  Locked -> Table lock
mysql-test/t/merge-big.test:
  Locked -> Table lock
mysql-test/t/multi_update.test:
  Locked -> Table lock
mysql-test/t/query_cache_28249.test:
  Locked -> Table lock
mysql-test/t/sp_notembedded.test:
  Locked -> Table lock
mysql-test/t/sp_sync.test:
  Locked -> Table lock
mysql-test/t/status.test:
  Locked -> Table lock
mysql-test/t/trigger_notembedded.test:
  Locked -> Table lock
mysys/thr_alarm.c:
  Added option to disable thr_alarm
mysys/thr_lock.c:
  Detect loops
scripts/mysql_install_db.sh:
  Give better error message if something goes wrong
sql/Makefile.am:
  Added sql_handler.h
sql/lock.cc:
  Split functions to allow one to cache value if store_lock() (for HANDLER functions).
  - Split mysql_lock_tables() into two functions, where first one allocates MYSQL_LOCK and other other one uses it.
  - Made get_lock_data() an external function.
  - Added argument to mysql_unlock_tables() to not free sql_lock.
  - Added argument to reset_lock_data() to reset lock structure to initial state (as after get_lock_data())
sql/mysql_priv.h:
  Moved handler function prototypes to sql_handler.h
  Added new lock functions.
sql/mysqld.cc:
  Added --thread-alarm startup option
sql/net_serv.cc:
  Don't call vio_blocking() if not needed
sql/sql_base.cc:
  include sql_handler.h
sql/sql_class.cc:
  include sql_handler.h
  Remove not anymore used 'thd->locked' member
sql/sql_class.h:
  Remove not anymore used 'thd->locked' member
sql/sql_db.cc:
  include sql_handler.h
sql/sql_delete.cc:
  include sql_handler.h
sql/sql_handler.cc:
  Rewrote all code to use SQL_HANDLER instead of TABLE_LIST (original interface)
  Rewrote mysql_ha_open() to cache all things from TABLE_LIST and items for field list, where etc.
  In mysql_ha_open() also cache MYSQL_LOCK structure from get_lock_data().
  Split functions into smaller sub functions (needed to be able to implement mysql_ha_read_prepare())
  Added mysql_ha_read_prepare() to allow one to prepare HANDLER READ.
sql/sql_handler.h:
  Interface to sql_handler.cc
sql/sql_parse.cc:
  include sql_handler.h
sql/sql_prepare.cc:
  Added mysql_test_handler_read(), prepare for HANDLER READ
sql/sql_rename.cc:
  include sql_handler.h
sql/sql_show.cc:
  Removed usage of thd->locked
sql/sql_table.cc:
  include sql_handler.h
sql/sql_trigger.cc:
  include sql_handler.h
2011-01-04 00:55:41 +02:00
Igor Babaev
f844a7bae7 Fixed LP bug#695304.
The bug was the result of a bad merge maria-5.2-wl21 -> 5.3.
2010-12-29 11:00:22 -08:00
Kent Boortz
4acfdb9df1 Merge 2010-12-29 00:47:05 +01:00
Kent Boortz
85323eda8a - Added/updated copyright headers
- Removed files specific to compiling on OS/2
- Removed files specific to SCO Unix packaging
- Removed "libmysqld/copyright", text is included in documentation
- Removed LaTeX headers for NDB Doxygen documentation
- Removed obsolete NDB files
- Removed "mkisofs" binaries
- Removed the "cvs2cl.pl" script
- Changed a few GPL texts to use "program" instead of "library"
2010-12-28 19:57:23 +01:00
Igor Babaev
0dc5ef87d4 Merge 2010-12-27 14:22:05 -08:00
unknown
34a48dd4a0 Merge MWL#116 into mariadb-5.2-rpl. 2010-12-25 15:42:33 +01:00
Igor Babaev
7d68e1ead7 Merge: mwl#24+mwl#21 5.1->5.2 2010-12-24 08:17:43 -08:00
Igor Babaev
6f2db629a0 Post-review fixes. 2010-12-22 18:45:44 -08:00
Tor Didriksen
029a5df870 Bug #58699 cannot build with gcc dbg on solaris
cmake/os/SunOS.cmake:
  Remove TARGET_OS_SOLARIS
config.h.cmake:
  Remove TARGET_OS_SOLARIS
  Add PTHREAD_ONCE_INITIALIZER
configure.cmake:
  Add function for testing whether we need { PTHREAD_ONCE_INIT } rather than PTHREAD_ONCE_INIT
include/my_pthread.h:
  Use PTHREAD_ONCE_INITIALIZER if set by cmake.
include/mysql/psi/mysql_file.h:
  Include my_global.h first, to get correct platform definitions.
mysys/ptr_cmp.c:
  Hide the unused static functions in #ifdef's on solaris.
  Use __sun (defined by both gcc and SunPro cc) rather than TARGET_OS_SOLARIS
sql/my_decimal.cc:
  Include my_global.h first, to get correct platform definitions.
sql/mysqld.cc:
  Fix signed/unsigned comparison warning.
sql/sql_audit.h:
  Include my_global.h first, to get correct platform definitions.
sql/sql_plugin.h:
  Include my_global.h first, to get correct platform definitions.
sql/sql_show.cc:
  Fix: warning: cast from pointer to integer of different size
sql/sys_vars.h:
  Use reinterpret_cast rather than c-style cast.
storage/perfschema/pfs_instr.cc:
  Include my_global.h first, to get correct platform definitions.
2010-12-21 13:00:26 +01:00
Luis Soares
b0e77d62f3 BUG#46166
Merging to latest mysql-5.5-bugteam.
2010-12-16 19:12:31 +00:00
Davi Arnaut
4e2cf44180 Bug#58136: Crash in vio_close at concurrent disconnect and KILL
The problem is a race between a session closing its vio
(i.e. after a COM_QUIT) at the same time it is being killed by
another thread. This could trigger a assertion in vio_close()
as the two threads could end up closing the same vio, at the
same time. This could happen due to the implementation of
SIGNAL_WITH_VIO_CLOSE, which closes the vio of the thread
being killed.

The solution is to serialize the close of the Vio under
LOCK_thd_data, which protects THD data.

No regression test is added as this is essentially a debug
issue and the test case would be quite convoluted as we would
need to synchronize a session that is being killed -- which
is a bit difficult since debug sync points code does not
synchronize killed sessions.

sql/mysqld.cc:
  Drop lock parameter from close_connection, its not necessary
  any more. The newly introduced THD::disconnect method will take
  care of locking.
sql/mysqld.h:
  Change prototype, add a default parameter for the error code.
sql/sql_class.cc:
  In case SIGNAL_WITH_VIO_CLOSE is defined, the active vio is
  closed and cleared. Subsequent calls will only close the vio
  owned by the session.
2010-12-15 20:59:21 -02:00
Sergey Petrunya
58b646001a Merge DS-MRR/CPK improvements into 5.3-main 2010-12-13 13:42:40 +03:00
Igor Babaev
7f52af655a Merge. 2010-12-10 23:23:34 -08:00
Igor Babaev
c4080280df Merge 2010-12-09 21:55:14 -08:00
Sergey Vojtovich
9a3e46c520 WL#5571 - Audit interface: MYSQL_AUDIT_GENERAL_STATUS event
include/mysql/plugin_audit.h:
  Connection auditing class.
include/mysql/plugin_audit.h.pp:
  Connection auditing class.
sql/mysqld.cc:
  Notify disconnect to auditing.
sql/sql_audit.cc:
  Connection class event dispatcher.
sql/sql_audit.h:
  mysql_audit_notify() is not available in embedded.
sql/sql_connect.cc:
  Notify connect to auditing.
sql/sql_parse.cc:
  Notify user change to auditing.
2010-12-14 17:34:23 +03:00
Ramil Kalimullin
7e4961bd51 Fix for bug #58669: read_only not enforced on 5.5.x
merged from mysql-5.5.8-release tree,
revision: ramil@mysql.com-20101203174908-217tdkn150vieha9
2010-12-07 20:08:54 +03:00
Luis Soares
26ee8f532e BUG#46166
Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.

Conflicts
=========

Text conflict in sql/log.cc
Text conflict in sql/log.h
Text conflict in sql/slave.cc
Text conflict in sql/sql_parse.cc
Text conflict in sql/sql_priv.h
2010-12-07 16:11:13 +00:00
Michael Widenius
b7b25dc666 Merge with 5.1-release.
- Fixed problem with oqgraph and 'make dist'

Note that after this merge we have a problem show in join_outer where we examine too many rows in one specific case (related to BUG#57024).
This will be fixed when mwl#128 is merged into 5.3.
2010-12-06 10:25:44 +02:00
unknown
be95cde859 Merge 5.3-mwl89 into 5.3. 2010-12-03 15:37:54 +02:00
Alfranio Correia
b28d2c25a7 merge mysql-5.5-bugteam(local) --> mysql-5.5-bugteam 2010-12-03 01:06:56 +00:00
Igor Babaev
80377bbf6d MWL #21: "index_merge: non-ROR intersection".
The second (final) patch.
2010-12-01 23:39:39 -08:00
Luis Soares
647c619393 BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
      
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
                  
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
                  
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.

mysql-test/include/restart_mysqld.inc:
  Refactored restart_mysqld so that it is not hardcoded for
  mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
  The error on open of index and binary log on new_file_impl 
  is now caught. Thence the user will get an error message. 
  We need to accomodate this change in the test case for the
  failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
  Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
  Added some test cases for asserting that the error is found 
  and reported.
sql/handler.cc:
  Catching error now returned by unlog (in ha_commit_trans) and 
  returning it.
sql/log.cc:
  Propagating errors from new_file_impl upwards. The errors that
  new_file_impl catches now are:
  - error on generate_new_name
  - error on writing the rotate event
  - error when opening the index or the binary log file.
sql/log.h:
  Changing declaration of:
  - rotate_and_purge
  - new_file
  - new_file_without_locking
  - new_file_impl
  - unlog
  They now return int instead of void.
sql/mysql_priv.h:
  Change signature of reload_acl_and_cache so that write_to_binlog
  is an int instead of bool.
sql/mysqld.cc:
  Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
  Changes to catch the return from rotate_and_purge.
sql/slave.cc:
  Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
  Changes to rotate_relay_log declaration (now returns int 
  instead of void).
sql/sql_load.cc:
  In SBR, some logging of LOAD DATA events goes through
  IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
  IO_CACHE implementation is ignoring the return value for from
  these callbacks (pre_read and post_read), so we need to find out
  at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
  Catching the rotate_relay_log and rotate_and_purge return values.
  Semantic change in reload_acl_and_cache so that we report errors
  in binlog interactions through the write_to_binlog output parameter.
  If there was any failure while rotating the binary log, we should
  then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
Davi Arnaut
e1e81ceb83 Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-11-30 17:06:53 -02:00
Michael Widenius
ab5e4eefd5 Fixed some compiler warnings found when compiling for windows.
Changed rows_read and rows_sent status variables to be longlong (to avoid compiler warnings)


sql/item_func.cc:
  Fixed wrong usage of alias
sql/item_subselect.cc:
  Changed buffer size to ulonglong to be able detect buffers bigger than size_t
sql/item_subselect.h:
  Changed buffer size to ulonglong to be able detect buffers bigger than size_t
sql/multi_range_read.cc:
  Fixed compiler warning by using correct type for function argument
sql/mysqld.cc:
  Changed rows_read and rows_sent status variables to be longlong
sql/opt_subselect.h:
  Fixed compiler warning by using correct type for function argument
sql/sql_class.cc:
  Changed rows_read and rows_sent status variables to be longlong
sql/sql_class.h:
  Changed rows_read and rows_sent status variables to be longlong
  Changed max_nulls_in_row to uint as this is number of columns in row.
  This fixed some compiler warnings.
sql/sql_select.cc:
  Added casts to avoid compiler warnings
storage/heap/ha_heap.cc:
  Initilize different types separate
storage/oqgraph/ha_oqgraph.cc:
  Fixed argument to store(longlong) to avoid compiler warnings
2010-11-30 01:27:14 +02:00
Davi Arnaut
d5e928959e Bug#51817: incorrect assumption: thd->query at 0x2ab2a8360360 is an invalid pointer
The problem is that the logic which checks if a pointer is
valid relies on a poor heuristic based on the start and end
addresses of the data segment and heap.

Apart from miscalculating the heap bounds, this approach also
suffers from the fact that memory can come from places other
than the heap. See Bug#58528 for a more detailed explanation.

On Linux, the solution is to access the process's memory
through /proc/self/task/<tid>/mem, which allows for retrieving
the contents of pages within the virtual address space of
the calling process. If a address range is not mapped, a
input/output error is returned.

client/mysqltest.cc:
  Use new interface to my_safe_print_str.
include/my_stacktrace.h:
  Drop name from my_safe_print_str.
mysys/stacktrace.c:
  Access the process's memory through a file descriptor and
  dump the contents of the memory range. The file descriptor
  offset is equivalent to a offset into the address space.
  
  Do not print the name of the variable associated with the
  address. It can be better accomplished at a higher level.
sql/mysqld.cc:
  Put the variable dumping information within its own newline block.
  Use symbolic names which better convey information to the user.
2010-11-26 19:59:10 -02:00
Sergei Golubchik
37f87d73ae updated sys_vars.cc (converting 5.3 mysqld.cc and set_var.cc
changes appropriately)
2010-11-26 12:22:40 +01:00
Sergei Golubchik
65ca700def merge.
checkpoint.
does not compile.
2010-11-25 18:17:28 +01:00
Tatiana A. Nurnberg
7336ac45b7 Assorted post-merge fixes, clean-up, integration, compat with 5.6.
43233/55794.

mysql-test/r/change_user.result:
  Don't use -1 integer wrap around. It used to work, but now we do what's
  actually in the documentation. In tests, we now use DEFAULT or the
  numeral equivalent (as we do in the 5.6 tests).
mysql-test/r/key_cache.result:
  Can't drop default key case is an error now, not a warning, for compatibility
  with 5.6.
mysql-test/r/variables.result:
  Can't drop default key case is an error now, not a warning, for compatibility
  with 5.6.
mysql-test/t/change_user.test:
  Don't use -1 integer wrap around. It used to work, but now we do what's
  actually in the documentation. In tests, we now use DEFAULT or the
  numeral equivalent (as we do in the 5.6 tests).
mysql-test/t/key_cache.test:
  Can't drop default key case is an error now, not a warning, for compatibility
  with 5.6.
mysql-test/t/variables.test:
  Can't drop default key case is an error now, not a warning, for compatibility
  with 5.6.
sql/mysqld.cc:
  0 is a legal (albeit magic) value: "drop key cache."
sql/set_var.cc:
  bound_unsigned() can go now, it was just a kludge until things are done
  The Right Way, which they are now.
  
  Can't drop default key case is an error now, not a warning, for compatibility
  with 5.6.
tests/mysql_client_test.c:
  Don't use -1 integer wrap around. It used to work, but now we do what's
  actually in the documentation. In tests, we now use DEFAULT or the
  numeral equivalent (as we do in the 5.6 tests).
2010-11-25 03:11:05 +00:00
Marc Alff
9d9699209d local merge 2010-11-21 14:32:48 +01:00
unknown
95b37a254b Merge MariaDB 5.1->5.2 2010-11-19 22:33:47 +01:00
unknown
0de9a4abab MWL#74: Shared libmysqld.so library.
Switch makefiles to use libtool to build libmysqld.so, as well as all its
dependencies.

The previous MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() declaration is removed,
as it does not work well with a libtool build. Instead, plugins that need it
can specify an alternate object in MYSQL_PLUGIN_STATIC() that will be used for
embedded library. The plugin must then take care itself of compiling the
special object for embedded, rebuilding the source files previously listed in
MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() with @plugin_embedded_defs@ in
CFLAGS/CXXFLAGS. The extra target @XXX_embedded_static_target@ is available
for the special object, this will be empty when --without-embedded-server.

All in-tree plugins are changed to build their static targets with libtool.
Additional plugins that want to work with libmysqld.so will need to be
similarly modified to build with libtool (or otherwise provide an -fPIC
object). Dynamically loaded plugins are not affected.

The old libraries like libmysys.a, libmyisam.a and similar libraries, which
were installed by `make install` though this is of little use, are still built
and installed to not break package scripts etc. that expect them. These
libraries are kept static to avoid introducing new .so dependencies.

The patch also fixes a handfull of duplicate symbol linker errors, where we
included some object twice during linking; these for one reason or another did
not produce errors before but caused problems on some platforms with this
patch (eg. Mac OS X linker is more strict for shared objects).

This patch only does what is necessary to build libmysqld.so. There are some
more cleanups that are possible now that we are using libtool more fully,
which could done in subsequent patches (though we may not bother as we are
switching from autotools to CMake anyway):

 - In libmysql_r/, we should be able to just link libmysys.la etc, instead of
   symlinking and re-compiling sources into the directory.

 - In libmysql/, we can similarly avoid symlinking and recompiling sources if
   we instead build a libmysys_nothread.la library with appropriate CFLAGS and
   link that.

 - In sql/, we can build a separate target libmysql_int.la with appropriate
   CFLAGS for embedded and use that in libmysqld/ instead of symlinking
   sources.

 - libmysys.a, libmyisam.a and similar libraries could be installed as .so
   also to save on code size; or alternatively could be not installed at all.


client/Makefile.am:
  Updated for using libtool
config/ac-macros/plugins.m4:
  Replace MUSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS with mechanism for plugins
  to specify alternate object for embedded.
configure.in:
  Fix linking duplicate objects related to THREAD_LOBJECTS.
dbug/Makefile.am:
  Updated for using libtool
extra/Makefile.am:
  Fix relative paths.
libmysqld/Makefile.am:
  Build libmysqld.la using libtool
libmysqld/examples/Makefile.am:
  Updated to use libtool
mysys/Makefile.am:
  Updated to use libtool.
  Fix linking duplicate objects related to THREAD_LOBJECTS.
mysys/my_uuid.c:
  Fix conflicting global mutex name by making it static.
regex/Makefile.am:
  Updated to use libtool
sql/Makefile.am:
  Updated to use libtool
sql/item_func.cc:
  Fix conflicting mutex name.
sql/mysql_priv.h:
  Fix conflicting mutex name
sql/mysqld.cc:
  Fix conflicting mutex name.
  Add missing call of my_uuid_end().
storage/archive/Makefile.am:
  Updated to use libtool
storage/archive/plug.in:
  Updated to use libtool
storage/blackhole/Makefile.am:
  Updated to use libtool
storage/blackhole/plug.in:
  Updated to use libtool
storage/csv/Makefile.am:
  Updated to use libtool
storage/csv/plug.in:
  Updated to use libtool
storage/example/Makefile.am:
  Updated to use libtool
storage/federated/Makefile.am:
  Updated to use libtool
storage/federated/plug.in:
  Updated to use libtool
storage/federatedx/Makefile.am:
  Updated to use libtool
storage/federatedx/plug.in:
  Updated to use libtool
storage/heap/Makefile.am:
  Updated to use libtool
storage/heap/plug.in:
  Updated to use libtool
storage/innobase/Makefile.am:
  Updated to use libtool
storage/innobase/plug.in.disabled:
  Updated to use libtool
storage/innodb_plugin/Makefile.am:
  Updated to use libtool
storage/maria/CMakeLists.txt:
  Fix linking duplicate object in maria_dump_log, causes failure on Mac OS X
storage/maria/Makefile.am:
  Updated to use libtool
  Fix linking duplicate object in maria_dump_log, causes link failure on Mac OS X
storage/maria/ma_loghandler.c:
  Move maria_dump_log code to separate file to fix duplicate object link failures.
storage/maria/ma_loghandler.h:
  Move maria_dump_log code to separate file to fix duplicate object link failures.
storage/maria/maria_dump_log.c:
  Move maria_dump_log code to separate file to fix duplicate object link failures.
storage/maria/plug.in:
  Updated to use libtool
storage/myisam/Makefile.am:
  Updated to use libtool
storage/myisam/plug.in:
  Updated to use libtool
storage/myisammrg/Makefile.am:
  Updated to use libtool
storage/myisammrg/plug.in:
  Updated to use libtool
storage/pbxt/plug.in:
  Updated to use libtool
storage/pbxt/src/Makefile.am:
  Updated to use libtool
storage/xtradb/Makefile.am:
  Updated to use libtool
storage/xtradb/plug.in:
  Updated to use libtool
strings/Makefile.am:
  Updated to use libtool
unittest/unit.pl:
  Don't attempt to run libtool internal files as unit tests.
vio/Makefile.am:
  Updated to use libtool
2010-11-17 13:24:20 +01:00
Jon Olav Hauglid
0caa22b145 Merge from mysql-5.5-bugteam to mysql-5.5-runtime
No conflicts
2010-11-16 10:05:19 +01:00
Marc Alff
ce89012c8b Bug#56760 PFS_lock::allocated_to_free() assert failures on osx10.5-x86-64bit
Before this fix, an assert could fail in PFS_lock::allocated_to_free(), during shutdown.
The assert itself is valid, and detects an anomaly caused by bug 56666.

While bug 56666 has no real consequences in production,
the failure caused by this new assert in the code is negatively
impacting the test suite with automated tests.

This fix is a work around only, that relaxes the integrity checks 
during the server shutdown.
2010-11-16 09:36:42 +01:00
Sergey Petrunya
9ab54acbf0 Merge MWL#121-125 DS-MRR improvements into MWL#128 Classic hash join tree 2010-11-15 04:45:49 +03:00
Jon Olav Hauglid
f11b9a88eb Merge from mysql-5.5-bugteam to mysql-5.5-runtime
Text conflict in mysql-test/suite/perfschema/r/dml_setup_instruments.result
Text conflict in mysql-test/suite/perfschema/r/global_read_lock.result
Text conflict in mysql-test/suite/perfschema/r/server_init.result
Text conflict in mysql-test/suite/perfschema/t/global_read_lock.test
Text conflict in mysql-test/suite/perfschema/t/server_init.test
2010-11-12 12:23:17 +01:00
Marc Alff
41dc34d60b Bug#58052 Binary log IO not being accounted for properly
Before this fix, file io for the binary log file was not accounted properly,
and showed no io at all.

This bug was due to the following issues:

1) file io for the binlog was instrumented:
- sometime as "wait/io/file/sql/binlog"
- sometime as "wait/io/file/sql/MYSQL_LOG"
leading to inconsistent event_names.

2) the binlog file itself was using an IO_CACHE,
but the IO_CACHE implementation in mysys/mf_iocache.c was
not instrumented to make performance schema calls to record file io.

3) The "wait/io/file/sql/MYSQL_LOG" instrumentation was used
for several log files, such as:
- the binary log
- the slow log
- the query log
which caused file io in these different log files to be accounted
against the same instrument.
The instrumentation needs to have a finer grain and report io
in different event_names, because each file really serves a different purpose.

With this fix:
- the IO_CACHE implementation is now instrumented
- the "wait/io/file/sql/MYSQL_LOG" instrument has been removed
- binlog io is now always instrumented with "wait/io/file/sql/binlog"
- the slow log is instrumented with a new name, "wait/io/file/sql/slow_log"
- the query log is instrumented with a new name, "wait/io/file/sql/query_log"
2010-11-12 07:23:26 +01:00
Dmitry Lenev
6bf6272fda Patch that refactors global read lock implementation and fixes
bug #57006 "Deadlock between HANDLER and FLUSH TABLES WITH READ
LOCK" and bug #54673 "It takes too long to get readlock for
'FLUSH TABLES WITH READ LOCK'".

The first bug manifested itself as a deadlock which occurred
when a connection, which had some table open through HANDLER
statement, tried to update some data through DML statement
while another connection tried to execute FLUSH TABLES WITH
READ LOCK concurrently.

What happened was that FTWRL in the second connection managed
to perform first step of GRL acquisition and thus blocked all
upcoming DML. After that it started to wait for table open
through HANDLER statement to be flushed. When the first connection
tried to execute DML it has started to wait for GRL/the second
connection creating deadlock.

The second bug manifested itself as starvation of FLUSH TABLES
WITH READ LOCK statements in cases when there was a constant
stream of concurrent DML statements (in two or more
connections).

This has happened because requests for protection against GRL
which were acquired by DML statements were ignoring presence of
pending GRL and thus the latter was starved.

This patch solves both these problems by re-implementing GRL
using metadata locks.

Similar to the old implementation acquisition of GRL in new
implementation is two-step. During the first step we block
all concurrent DML and DDL statements by acquiring global S
metadata lock (each DML and DDL statement acquires global IX
lock for its duration). During the second step we block commits
by acquiring global S lock in COMMIT namespace (commit code
acquires global IX lock in this namespace).

Note that unlike in old implementation acquisition of
protection against GRL in DML and DDL is semi-automatic.
We assume that any statement which should be blocked by GRL
will either open and acquires write-lock on tables or acquires
metadata locks on objects it is going to modify. For any such
statement global IX metadata lock is automatically acquired
for its duration.

The first problem is solved because waits for GRL become
visible to deadlock detector in metadata locking subsystem
and thus deadlocks like one in the first bug become impossible.

The second problem is solved because global S locks which
are used for GRL implementation are given preference over
IX locks which are acquired by concurrent DML (and we can
switch to fair scheduling in future if needed).

Important change:
FTWRL/GRL no longer blocks DML and DDL on temporary tables.
Before this patch behavior was not consistent in this respect:
in some cases DML/DDL statements on temporary tables were
blocked while in others they were not. Since the main use cases
for FTWRL are various forms of backups and temporary tables are
not preserved during backups we have opted for consistently
allowing DML/DDL on temporary tables during FTWRL/GRL.

Important change:
This patch changes thread state names which are used when
DML/DDL of FTWRL is waiting for global read lock. It is now
either "Waiting for global read lock" or "Waiting for commit
lock" depending on the stage on which FTWRL is.

Incompatible change:
To solve deadlock in events code which was exposed by this
patch we have to replace LOCK_event_metadata mutex with
metadata locks on events. As result we have to prohibit
DDL on events under LOCK TABLES.

This patch also adds extensive test coverage for interaction
of DML/DDL and FTWRL.

Performance of new and old global read lock implementations
in sysbench tests were compared. There were no significant
difference between new and old implementations.

mysql-test/include/check_ftwrl_compatible.inc:
  Added helper script which allows to check that a statement is
  compatible with FLUSH TABLES WITH READ LOCK.
mysql-test/include/check_ftwrl_incompatible.inc:
  Added helper script which allows to check that a statement is
  incompatible with FLUSH TABLES WITH READ LOCK.
mysql-test/include/handler.inc:
  Adjusted test case to the fact that now DROP TABLE closes
  open HANDLERs for the table to be dropped before checking
  if there active FTWRL in this connection.
mysql-test/include/wait_show_condition.inc:
  Fixed small error in the timeout message. The correct name
  of variable used as parameter for this script is "$condition"
  and not "$wait_condition".
mysql-test/r/delayed.result:
  Added test coverage for scenario which triggered assert in
  metadata locking subsystem.
mysql-test/r/events_2.result:
  Updated test results after prohibiting event DDL operations
  under LOCK TABLES.
mysql-test/r/flush.result:
  Added test coverage for bug #57006 "Deadlock between HANDLER
  and FLUSH TABLES WITH READ LOCK".
mysql-test/r/flush_read_lock.result:
  Added test coverage for various aspects of FLUSH TABLES WITH
  READ LOCK functionality.
mysql-test/r/flush_read_lock_kill.result:
  Adjusted test case after replacing custom global read lock
  implementation with one based on metadata locks. Use new
  debug_sync point. Do not disable concurrent inserts as now
  InnoDB we always use InnoDB table.
mysql-test/r/handler_innodb.result:
  Adjusted test case to the fact that now DROP TABLE closes
  open HANDLERs for the table to be dropped before checking
  if there active FTWRL in this connection.
mysql-test/r/handler_myisam.result:
  Adjusted test case to the fact that now DROP TABLE closes
  open HANDLERs for the table to be dropped before checking
  if there active FTWRL in this connection.
mysql-test/r/mdl_sync.result:
  Adjusted test case after replacing custom global read lock
  implementation with one based on metadata locks. Replaced
  usage of GRL-specific debug_sync's with appropriate sync
  points in MDL subsystem.
mysql-test/suite/perfschema/r/dml_setup_instruments.result:
  Updated test results after removing global
  COND_global_read_lock condition variable.
mysql-test/suite/perfschema/r/func_file_io.result:
  Ensure that this test doesn't affect subsequent tests.
  At the end of its execution enable back P_S instrumentation
  which this test disables at some point.
mysql-test/suite/perfschema/r/func_mutex.result:
  Ensure that this test doesn't affect subsequent tests.
  At the end of its execution enable back P_S instrumentation
  which this test disables at some point.
mysql-test/suite/perfschema/r/global_read_lock.result:
  Adjusted test case to take into account that new GRL
  implementation is based on MDL.
mysql-test/suite/perfschema/r/server_init.result:
  Adjusted test case after replacing custom global read
  lock implementation with one based on MDL and replacing
  LOCK_event_metadata mutex with metadata lock.
mysql-test/suite/perfschema/t/func_file_io.test:
  Ensure that this test doesn't affect subsequent tests.
  At the end of its execution enable back P_S instrumentation
  which this test disables at some point.
mysql-test/suite/perfschema/t/func_mutex.test:
  Ensure that this test doesn't affect subsequent tests.
  At the end of its execution enable back P_S instrumentation
  which this test disables at some point.
mysql-test/suite/perfschema/t/global_read_lock.test:
  Adjusted test case to take into account that new GRL
  implementation is based on MDL.
mysql-test/suite/perfschema/t/server_init.test:
  Adjusted test case after replacing custom global read
  lock implementation with one based on MDL and replacing
  LOCK_event_metadata mutex with metadata lock.
mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result:
  Updated test results after prohibiting event DDL under
  LOCK TABLES.
mysql-test/t/delayed.test:
  Added test coverage for scenario which triggered assert in
  metadata locking subsystem.
mysql-test/t/events_2.test:
  Updated test case after prohibiting event DDL operations
  under LOCK TABLES.
mysql-test/t/flush.test:
  Added test coverage for bug #57006 "Deadlock between HANDLER
  and FLUSH TABLES WITH READ LOCK".
mysql-test/t/flush_block_commit.test:
  Adjusted test case after changing thread state name which
  is used when COMMIT waits for FLUSH TABLES WITH READ LOCK
  from "Waiting for release of readlock" to "Waiting for commit
  lock".
mysql-test/t/flush_block_commit_notembedded.test:
  Adjusted test case after changing thread state name which is
  used when DML waits for FLUSH TABLES WITH READ LOCK. Now we
  use "Waiting for global read lock" in this case.
mysql-test/t/flush_read_lock.test:
  Added test coverage for various aspects of FLUSH TABLES WITH
  READ LOCK functionality.
mysql-test/t/flush_read_lock_kill-master.opt:
  We no longer need to use make_global_read_lock_block_commit_loop
  debug tag in this test. Instead we rely on an appropriate
  debug_sync point in MDL code.
mysql-test/t/flush_read_lock_kill.test:
  Adjusted test case after replacing custom global read lock
  implementation with one based on metadata locks. Use new
  debug_sync point. Do not disable concurrent inserts as now
  InnoDB we always use InnoDB table.
mysql-test/t/lock_multi.test:
  Adjusted test case after changing thread state names which
  are used when DML or DDL waits for FLUSH TABLES WITH READ
  LOCK to "Waiting for global read lock".
mysql-test/t/mdl_sync.test:
  Adjusted test case after replacing custom global read lock
  implementation with one based on metadata locks. Replaced
  usage of GRL-specific debug_sync's with appropriate sync
  points in MDL subsystem. Updated thread state names which
  are used when DDL waits for FTWRL.
mysql-test/t/trigger_notembedded.test:
  Adjusted test case after changing thread state names which
  are used when DML or DDL waits for FLUSH TABLES WITH READ
  LOCK to "Waiting for global read lock".
sql/event_data_objects.cc:
  Removed Event_queue_element::status/last_executed_changed
  members and Event_queue_element::update_timing_fields()
  method. We no longer use this class for updating mysql.events
  once event is chosen for execution. Accesses to instances of
  this class in scheduler thread require protection by
  Event_queue::LOCK_event_queue mutex and we try to avoid
  updating table while holding this lock.
sql/event_data_objects.h:
  Removed Event_queue_element::status/last_executed_changed
  members and Event_queue_element::update_timing_fields()
  method. We no longer use this class for updating mysql.events
  once event is chosen for execution. Accesses to instances of
  this class in scheduler thread require protection by
  Event_queue::LOCK_event_queue mutex and we try to avoid
  updating table while holding this lock.
sql/event_db_repository.cc:
  - Changed Event_db_repository methods to not release all
    metadata locks once they are done updating mysql.events
    table. This allows to keep metadata lock protecting
    against GRL and lock protecting particular event around
    until corresponding DDL statement is written to the binary
    log.
  - Removed logic for conditional update of "status" and
    "last_executed" fields from update_timing_fields_for_event()
    method. In the only case when this method is called now
    "last_executed" is always modified and tracking change
    of "status" is too much hassle.
sql/event_db_repository.h:
  Removed logic for conditional update of "status" and
  "last_executed" fields from Event_db_repository::
  update_timing_fields_for_event() method.
  In the only case when this method is called now "last_executed"
  is always modified and tracking change of "status" field is
  too much hassle.
sql/event_queue.cc:
  Changed event scheduler code not to update mysql.events
  table while holding Event_queue::LOCK_event_queue mutex.
  Doing so led to a deadlock with a new GRL implementation.
  This deadlock didn't occur with old implementation due to
  fact that code acquiring protection against GRL ignored
  pending GRL requests (which lead to GRL starvation).
  One of goals of new implementation is to disallow GRL
  starvation and so we have to solve problem with this
  deadlock in a different way.
sql/events.cc:
  Changed methods of Events class to acquire protection
  against GRL while perfoming DDL statement and keep it
  until statement is written to the binary log.
  Unfortunately this step together with new GRL implementation
  exposed deadlock involving Events::LOCK_event_metadata
  and GRL. To solve it Events::LOCK_event_metadata mutex was
  replaced with a metadata lock on event. As a side-effect
  events DDL has to be prohibited under LOCK TABLES even in
  cases when mysql.events table was explicitly locked for
  write.
sql/events.h:
  Replaced Events::LOCK_event_metadata mutex with a metadata
  lock on event.
sql/ha_ndbcluster.cc:
  Updated code after replacing custom global read lock
  implementation with one based on MDL. Since MDL subsystem
  should now be able to detect deadlocks involving metadata
  locks and GRL there is no need for special handling of
  active GRL.
sql/handler.cc:
  Replaced custom implementation of global read lock with
  one based on metadata locks. Consequently when doing
  commit instead of calling method of Global_read_lock
  class to acquire protection against GRL we simply acquire
  IX in COMMIT namespace.
sql/lock.cc:
  Replaced custom implementation of global read lock with
  one based on metadata locks. This step allows to expose
  wait for GRL to deadlock detector of MDL subsystem and
  thus succesfully resolve deadlocks similar to one behind
  bug #57006 "Deadlock between HANDLER and FLUSH TABLES
  WITH READ LOCK". It also solves problem with GRL starvation
  described in bug #54673 "It takes too long to get readlock
  for 'FLUSH TABLES WITH READ LOCK'" since metadata locks used
  by GRL give preference to FTWRL statement instead of DML
  statements (if needed in future this can be changed to
  fair scheduling).
  
  Similar to old implementation of acquisition of GRL is
  two-step. During the first step we block all concurrent
  DML and DDL statements by acquiring global S metadata lock
  (each DML and DDL statement acquires global IX lock for
  its duration). During the second step we block commits by
  acquiring global S lock in COMMIT namespace (commit code
  acquires global IX lock in this namespace).
  
  Note that unlike in old implementation acquisition of
  protection against GRL in DML and DDL is semi-automatic.
  We assume that any statement which should be blocked by GRL
  will either open and acquires write-lock on tables or acquires
  metadata locks on objects it is going to modify. For any such
  statement global IX metadata lock is automatically acquired
  for its duration.
  
  To support this change:
  - Global_read_lock::lock/unlock_global_read_lock and
    make_global_read_lock_block_commit methods were changed
    accordingly.
  - Global_read_lock::wait_if_global_read_lock() and
    start_waiting_global_read_lock() methods were dropped.
    It is now responsibility of code acquiring metadata locks
    opening tables to acquire protection against GRL by
    explicitly taking global IX lock with statement duration.
  - Global variables, mutex and condition variable used by
    old implementation was removed.
  - lock_routine_name() was changed to use statement duration for
    its global IX lock. It was also renamed to lock_object_name()
    as it now also used to take metadata locks on events.
  - Global_read_lock::set_explicit_lock_duration() was added which
    allows not to release locks used for GRL when leaving prelocked
    mode.
sql/lock.h:
  - Renamed lock_routine_name() to lock_object_name() and changed
    its signature to allow its usage for events.
  - Removed broadcast_refresh() function. It is no longer needed
    with new GRL implementation.
sql/log_event.cc:
  Release metadata locks with statement duration at the end
  of processing legacy event for LOAD DATA. This ensures that
  replication thread processing such event properly releases
  its protection against global read lock.
sql/mdl.cc:
  Changed MDL subsystem to support new MDL-based implementation
  of global read lock.
  
  Added COMMIT and EVENTS namespaces for metadata locks. Changed
  thread state name for GLOBAL namespace to "Waiting for global
  read lock".
  
  Optimized MDL_map::find_or_insert() method to avoid taking
  m_mutex mutex when looking up MDL_lock objects for GLOBAL
  or COMMIT namespaces. We keep pre-created MDL_lock objects
  for these namespaces around and simply return pointers to
  these global objects when needed.
  
  Changed MDL_lock/MDL_scoped_lock to properly handle
  notification of insert delayed handler threads when FTWRL
  takes global S lock.
  
  Introduced concept of lock duration. In addition to locks with
  transaction duration which work in the way which is similar to
  how locks worked before (i.e. they are released at the end of
  transaction), locks with statement and explicit duration were
  introduced.
  Locks with statement duration are automatically released at the
  end of statement. Locks with explicit duration require explicit
  release and obsolete concept of transactional sentinel.
  
  * Changed MDL_request and MDL_ticket classes to support notion
    of duration.
  * Changed MDL_context to keep locks with different duration in
    different lists. Changed code handling ticket list to take
    this into account.
  * Changed methods responsible for releasing locks to take into
    account duration of tickets. Particularly public
    MDL_context::release_lock() method now only can release
    tickets with explicit duration (there is still internal
    method which allows to specify duration). To release locks
    with statement or transaction duration one have to use
    release_statement/transactional_locks() methods.
  * Concept of savepoint for MDL subsystem now has to take into
    account locks with statement duration. Consequently
    MDL_savepoint class was introduced and methods working with
    savepoints were updated accordingly.
  * Added methods which allow to set duration for one or all
    locks in the context.
sql/mdl.h:
  Changed MDL subsystem to support new MDL-based implementation
  of global read lock.
  
  Added COMMIT and EVENTS namespaces for metadata locks.
  
  Introduced concept of lock duration. In addition to locks with
  transaction duration which work in the way which is similar to
  how locks worked before (i.e. they are released at the end of
  transaction), locks with statement and explicit duration were
  introduced.
  Locks with statement duration are automatically released at the
  end of statement. Locks with explicit duration require explicit
  release and obsolete concept of transactional sentinel.
  
  * Changed MDL_request and MDL_ticket classes to support notion
    of duration.
  * Changed MDL_context to keep locks with different duration in
    different lists. Changed code handling ticket list to take
    this into account.
  * Changed methods responsible for releasing locks to take into
    account duration of tickets. Particularly public
    MDL_context::release_lock() method now only can release
    tickets with explicit duration (there is still internal
    method which allows to specify duration). To release locks
    with statement or transaction duration one have to use
    release_statement/transactional_locks() methods.
  * Concept of savepoint for MDL subsystem now has to take into
    account locks with statement duration. Consequently
    MDL_savepoint class was introduced and methods working with
    savepoints were updated accordingly.
  * Added methods which allow to set duration for one or all
    locks in the context.
sql/mysqld.cc:
  Removed global mutex and condition variables which were used
  by old implementation of GRL.
  Also we no longer need to initialize Events::LOCK_event_metadata
  mutex as it was replaced with metadata locks on events.
sql/mysqld.h:
  Removed global variable, mutex and condition variables which
  were used by old implementation of GRL.
sql/rpl_rli.cc:
  When slave thread closes tables which were open for handling
  of RBR events ensure that it releases global IX lock which
  was acquired as protection against GRL.
sql/sp.cc:
  Adjusted code to the new signature of lock_object/routine_name(),
  to the fact that one now needs specify duration of lock when
  initializing MDL_request and to the fact that savepoints for MDL
  subsystem are now represented by MDL_savepoint class.
sql/sp_head.cc:
  Ensure that statements in stored procedures release statement
  metadata locks and thus release their protectiong against GRL
  in proper moment in time.
  Adjusted code to the fact that one now needs specify duration
  of lock when initializing MDL_request.
sql/sql_admin.cc:
  Adjusted code to the fact that one now needs specify duration
  of lock when initializing MDL_request.
sql/sql_base.cc:
  - Implemented support for new approach to acquiring protection
    against global read lock. We no longer acquire such protection
    explicitly on the basis of statement flags. Instead we always
    rely on code which is responsible for acquiring metadata locks
    on object to be changed acquiring this protection. This is
    achieved by acquiring global IX metadata lock with statement
    duration. Code doing this also responsible for checking that
    current connection has no active GRL by calling an
    Global_read_lock::can_acquire_protection() method.
    Changed code in open_table() and lock_table_names()
    accordingly.
    Note that as result of this change DDL and DML on temporary
    tables is always compatible with GRL (before it was
    incompatible in some cases and compatible in other cases).
  - To speed-up code acquiring protection against GRL introduced
    m_has_protection_against_grl member in Open_table_context
    class. It indicates that protection was already acquired
    sometime during open_tables() execution and new attempts
    can be skipped.
  - Thanks to new GRL implementation calls to broadcast_refresh()
    became unnecessary and were removed.
  - Adjusted code to the fact that one now needs specify duration
    of lock when initializing MDL_request and to the fact that
    savepoints for MDL subsystem are now represented by
    MDL_savepoint class.
sql/sql_base.h:
  Adjusted code to the fact that savepoints for MDL subsystem are
  now represented by MDL_savepoint class.
  Also introduced Open_table_context::m_has_protection_against_grl
  member which allows to avoid acquiring protection against GRL
  while opening tables if such protection was already acquired.
sql/sql_class.cc:
  Changed THD::leave_locked_tables_mode() after transactional
  sentinel for metadata locks was obsoleted by introduction of
  locks with explicit duration.
sql/sql_class.h:
  - Adjusted code to the fact that savepoints for MDL subsystem
    are now represented by MDL_savepoint class.
  - Changed Global_read_lock class according to changes in
    global read lock implementation:
    * wait_if_global_read_lock and start_waiting_global_read_lock
      are now gone. Instead code needing protection against GRL
      has to acquire global IX metadata lock with statement
      duration itself. To help it new can_acquire_protection()
      was introduced. Also as result of the above change
      m_protection_count member is gone too.
    * Added m_mdl_blocks_commits_lock member to store metadata
      lock blocking commits.
    * Adjusted code to the fact that concept of transactional
      sentinel was obsoleted by concept of lock duration.
  - Removed CF_PROTECT_AGAINST_GRL flag as it is no longer
    necessary. New GRL implementation acquires protection
    against global read lock automagically when statement
    acquires metadata locks on tables or other objects it
    is going to change.
sql/sql_db.cc:
  Adjusted code to the fact that one now needs specify duration
  of lock when initializing MDL_request.
sql/sql_handler.cc:
  Removed call to broadcast_refresh() function. It is no longer
  needed with new GRL implementation.
  Adjusted code after introducing duration concept for metadata
  locks. Particularly to the fact transactional sentinel was
  replaced with explicit duration.
sql/sql_handler.h:
  Renamed mysql_ha_move_tickets_after_trans_sentinel() to
  mysql_ha_set_explicit_lock_duration() after transactional
  sentinel was obsoleted by locks with explicit duration.
sql/sql_insert.cc:
  Adjusted code handling delaying inserts after switching to
  new GRL implementation. Now connection thread initiating
  delayed insert has to acquire global IX lock in addition
  to metadata lock on table being inserted into. This IX lock
  protects against GRL and similarly to SW lock on table being
  inserted into has to be passed to handler thread in order to
  avoid deadlocks.
sql/sql_lex.cc:
  LEX::protect_against_global_read_lock member is no longer
  necessary since protection against GRL is automatically
  taken by code acquiring metadata locks/opening tables.
sql/sql_lex.h:
  LEX::protect_against_global_read_lock member is no longer
  necessary since protection against GRL is automatically
  taken by code acquiring metadata locks/opening tables.
sql/sql_parse.cc:
  - Implemented support for new approach to acquiring protection
    against global read lock. We no longer acquire such protection
    explicitly on the basis of statement flags. Instead we always
    rely on code which is responsible for acquiring metadata locks
    on object to be changed acquiring this protection. This is
    achieved by acquiring global IX metadata lock with statement
    duration. This lock is automatically released at the end of
    statement execution.
  - Changed implementation of CREATE/DROP PROCEDURE/FUNCTION not
    to release metadata locks and thus protection against of GRL
    in the middle of statement execution.
  - Adjusted code to the fact that one now needs specify duration
    of lock when initializing MDL_request and to the fact that
    savepoints for MDL subsystem are now represented by
    MDL_savepoint class.
sql/sql_prepare.cc:
  Adjusted code to the to the fact that savepoints for MDL
  subsystem are now represented by MDL_savepoint class.
sql/sql_rename.cc:
  With new GRL implementation there is no need to explicitly
  acquire protection against GRL before renaming tables.
  This happens automatically in code which acquires metadata
  locks on tables being renamed.
sql/sql_show.cc:
  Adjusted code to the fact that one now needs specify duration
  of lock when initializing MDL_request and to the fact that
  savepoints for MDL subsystem are now represented by
  MDL_savepoint class.
sql/sql_table.cc:
  - With new GRL implementation there is no need to explicitly
    acquire protection against GRL before dropping tables.
    This happens automatically in code which acquires metadata
    locks on tables being dropped.
  - Changed mysql_alter_table() not to release lock on new table
    name explicitly and to rely on automatic release of locks
    at the end of statement instead. This was necessary since
    now MDL_context::release_lock() is supported only for locks
    for explicit duration.
sql/sql_trigger.cc:
  With new GRL implementation there is no need to explicitly
  acquire protection against GRL before changing table triggers.
  This happens automatically in code which acquires metadata
  locks on tables which triggers are to be changed.
sql/sql_update.cc:
  Fix bug exposed by GRL testing. During prepare phase acquire
  only S metadata locks instead of SW locks to keep prepare of
  multi-UPDATE compatible with concurrent LOCK TABLES WRITE
  and global read lock.
sql/sql_view.cc:
  With new GRL implementation there is no need to explicitly
  acquire protection against GRL before creating view.
  This happens automatically in code which acquires metadata
  lock on view to be created.
sql/sql_yacc.yy:
  LEX::protect_against_global_read_lock member is no longer
  necessary since protection against GRL is automatically
  taken by code acquiring metadata locks/opening tables.
sql/table.cc:
  Adjusted code to the fact that one now needs specify duration
  of lock when initializing MDL_request.
sql/table.h:
  Adjusted code to the fact that one now needs specify duration
  of lock when initializing MDL_request.
sql/transaction.cc:
  Replaced custom implementation of global read lock with
  one based on metadata locks. Consequently when doing
  commit instead of calling method of Global_read_lock
  class to acquire protection against GRL we simply acquire
  IX in COMMIT namespace.
  Also adjusted code to the fact that MDL savepoint is now
  represented by MDL_savepoint class.
2010-11-11 20:11:05 +03:00
Davi Arnaut
51ffca50b6 Bug#58080: Crash on failure to create a thread to handle a user connection
The problem was that the scheduler function used to handle a
new user connection could use the ER() macro without having a
THD object bound to the current thread. The crash would happen
whenever the function failed to create a new thread to handle a
user connection. Thread creation can fail due to lack or limit
of available resources.

The solution is to simply use the ER_THD() macro instead and pass
to it the THD object which would be bound to the connection.

Fix was tested manually. In a test case, it is too cumbersome to
inject a error in this context.

sql/mysqld.cc:
  Use ER_THD and pass the object.
2010-11-09 13:59:33 -02:00
Davi Arnaut
1b88853ab8 Bug#57210: remove pstack
Quoting from the bug report:

The pstack library has been included in MySQL since version
4.0.0. It's useless and should be removed.

Details: According to its own documentation, pstack only works
on Linux on x86 in 32 bit mode and requires LinuxThreads and a
statically linked binary. It doesn't really support any Linux
from 2003 or later and doesn't work on any other OS.

The --enable-pstack option is thus deprecated and has no effect.
2010-11-09 12:45:13 -02:00
unknown
7a28f61ded MBug#643463: Slow XtraDB shutdown: Fix more sleeps delaying shutdown.
This patch removes most remaining delays due to uninteruptible sleep()
during shutdown, as found using PMP. This makes standard test run very
close in speed to with --loose-innodb-fast-shutdown=2, and greatly
speeds up running the test suite.

sql/mysqld.cc:
  Poll for threads to die every 20 msec during shutdown, rather than force
  a wait for 2 full seconds should one thread be a little slow to exit
  (this was seen occasionally in mysql-test-run).
storage/xtradb/include/srv0srv.h:
  Rename the event, as we now use it to wakeup more threads during shutdown.
storage/xtradb/log/log0log.c:
  Rename the event, as we now use it to wakeup more threads during shutdown.
storage/xtradb/srv/srv0srv.c:
  Replace some hardcoded sleep()s with os_wait_event_time() that can be
  interrupted early during server shutdown to avoid unnecessary delays.
2010-11-09 15:03:57 +01:00
Michael Widenius
9d68ccdeb8 Added option BACKUP_ALL to mysqld --myisam-recover to also get a backup of the index file before it's repaired.
Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in Aria log handler.

extra/replace.c:
  Updated call to my_redel()
include/maria.h:
  Updated prototype for maria_change_to_newfile
include/my_sys.h:
  Updated prototypes
  Added my_create_backup_name
include/myisam.h:
  Updated prototypes
include/myisamchk.h:
  Added 'backup_time' to st_handler_check_param to be able to generate same name for backuped data and index file
mysys/my_redel.c:
  Added time_t option to my_redel() to be able to generate same backup extensions for many files
sql/handler.cc:
  Added start_time to st_ha_check_opt
sql/handler.h:
  Added start_time to HA_CHECK_OPT
sql/mysqld.cc:
  Added option BACKUP_ALL to --myisam-recover
storage/maria/ha_maria.cc:
  Remember start time for repair
storage/maria/ma_check.c:
  Use remembered start time for backup file names
  Removed some dead code
storage/maria/ma_loghandler.c:
  Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in log handler.
storage/maria/maria_chk.c:
  Removed dead code (O_NEW_INDEX was never set)
  Report if table was 'crashed on repair'
storage/maria/maria_pack.c:
  Updated parameters to my_redel()
storage/myisam/ha_myisam.cc:
  Added recover option BACKUP_ALL to get a backup of the index file before it's repaired.
  Print information to log if we make a backup of data as part of repair.
storage/myisam/ha_myisam.h:
  Added HA_RECOVER_FULL_BACKUP
storage/myisam/mi_check.c:
  Use remembered start time for backup file names
  Added mi_make_backup_of_index()
storage/myisam/myisamchk.c:
  Removed dead code (O_NEW_INDEX was never set)
  Report if table was 'crashed on repair'
storage/myisam/myisampack.c:
  Updated call to my_redel()
2010-11-07 14:25:29 +02:00
Igor Babaev
71e48fbf3e Merge 2010-11-05 19:01:47 -07:00
Alfranio Correia
3f5a9c7ea0 BUG#57275 binlog_cache_size affects trx- and stmt-cache and gets twice the expected memory
After the WL#2687, the binlog_cache_size and max_binlog_cache_size affect both the
stmt-cache and the trx-cache. This means that the resource used is twice the amount
expected/defined by the user.
      
The binlog_cache_use is incremented when the stmt-cache or the trx-cache is used
and binlog_cache_disk_use is incremented when the disk space from the stmt-cache or the
trx-cache is used. This behavior does not allow to distinguish which cache may be harming
performance due to the extra disk accesses and needs to have its in-memory cache
increased.
      
To fix the problem, we introduced two new options and status variables related to the
stmt-cache:
      
  Options:
      
    . binlog_stmt_cache_size
    . max_binlog_stmt_cache_size
      
    Status Variables:
      
    . binlog_stmt_cache_use
    . binlog_stmt_cache_disk_use

So there are

  . binlog_cache_size that defines the size of the transactional cache for
  updates to transactional engines for the binary log.

  . binlog_stmt_cache_size that defines the size of the statement cache for
  updates to non-transactional engines for the binary log.

  . max_binlog_cache_size that sets the total size of the transactional
  cache.

  . max_binlog_stmt_cache_size that sets the total size of the statement
  cache.

  . binlog_cache_use that identifies the number of transactions that used the
  temporary transactional binary log cache.

  . binlog_cache_disk_use that identifies the number of transactions that used
  the temporary transactional binary log cache but that exceeded the value of
  binlog_cache_size.

  . binlog_stmt_cache_use that identifies the number of statements that used the
  temporary non-transactional binary log cache.

  . binlog_stmt_cache_disk_use that identifies the number of statements that used
  the temporary non-transactional binary log cache but that exceeded the value of
  binlog_stmt_cache_size.

include/my_sys.h:
  Updated message on disk_writes' usage.
mysql-test/extra/binlog_tests/binlog_cache_stat.test:
  Updated the test case and added code to check the new status variables
  binlog_stmt_cache_use and binlog_stmt_cache_disk_use.
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test:
  Updated the test case to use the new system variables max_binlog_stmt_cache_size and binlog_stmt_cache_size.
mysql-test/r/mysqld--help-notwin.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_row_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_stm_cache_stat.result:
  Updated the result file.
mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result:
  Update the result file.
mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result:
  Update the result file.
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result:
  Updated the result file.
mysql-test/suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc:
  Added a test case to check the binlog_stmt_cache_size.
mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result:
  Updated the result file.
mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_64.result:
  Updated the result file.
mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result:
  Updated the result file.
mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_32.test:
  Added a test case to check the binlog_stmt_cache_size.
mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_64.test:
  Added a test case to check the binlog_stmt_cache_size.
mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt:
  Removed because there is no test case max_binlog_cache_size_func.
mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test:
  Added a test case to check the system variable max_binlog_stmt_cache_size.
sql/log.cc:
  There two main changes in here:
  
    . Changed the set_write_error() as an error message is set according
    to the type of the cache.
  
    . Created the function set_binlog_cache_info where references to the
    appropriate status and system variables are set and the server can
    smoothly compute statistics and set the maximum size for each cache.
sql/log.h:
  Changed the signature of the function in order to identify the error message
  to be printed out as there is a different error code for each type of cache.
sql/mysqld.cc:
  Added new status variables binlog_stmt_cache_use and binlog_stmt_cache_disk_use.
sql/mysqld.h:
  Added new system variables max_binlog_stmt_cache_size and binlog_stmt_cache_size.
sql/share/errmsg-utf8.txt:
  Added new error message related to the statement cache.
sql/sys_vars.cc:
  Added new system variables max_binlog_stmt_cache_size and binlog_stmt_cache_size.
2010-11-05 17:42:37 +00:00
Guilhem Bichot
03b9e73878 Fix for BUG#57316 "It is not clear how to disable autocommit"
add boolean command-line option --autocommit.

mysql-test/mysql-test-run.pl:
  do in --gdb like in --ddd: to let the developer debug the startup
  phase (like command-line options parsing), don't "run".
  It's the third time I do this change, it was previously lost
  by merges, port of 6.0 to next-mr...
mysql-test/r/mysqld--help-notwin.result:
  new command-line option
mysql-test/r/mysqld--help-win.result:
  a Linux user's best guess at what the Windows result should be
mysql-test/suite/sys_vars/inc/autocommit_func2.inc:
  new test
mysql-test/suite/sys_vars/t/autocommit_func2-master.opt:
  test new option
mysql-test/suite/sys_vars/t/autocommit_func3-master.opt:
  test new option
sql/mysqld.cc:
  new --autocommit
sql/mysqld.h:
  new --autocommit
sql/sql_partition.cc:
  What matters to this partitioning quote is to have
  the OPTION_QUOTE_SHOW_CREATE flag down, it's all
  that append_identifier() uses. So we make it explicit.
2010-11-05 14:16:27 +01:00
unknown
bc7369b74b MWL#89: Cost-based choice between Materialization and IN->EXISTS transformation
Merge 5.3-mwl89 into 5.3 main.

There is one remaining test failure in this merge:
innodb_mysql_lock2. All other tests have been checked to
deliver the same results/explains as 5.3-mwl89, including
the few remaining wrong results.
2010-11-05 14:42:58 +02:00
Michael Widenius
c670b9021e Automerge with 5.2 2010-11-05 12:37:51 +02:00
Michael Widenius
3797ca41b3 Automatic merge with 5.1 2010-11-04 16:53:10 +02:00
He Zhenxing
6429e7d36b BUG#47027 delegates_init() failure is not user friendly (usability issue)
Function delegetas_init() did not report proper error messages
when there are failures, which made it hard to know where the problem
occurred.

Fixed the problem by adding specific error message for every possible
place that can fail. And since these failures are supposed to never
happen, ask the user to report a bug if they happened.
2010-11-04 13:29:16 +08:00
Igor Babaev
517fc164cd Merge 2010-11-02 16:30:42 -07:00
Michael Widenius
20acfbf30d Fix for: LP #634955: Assert in _ma_update_at_original_place()
Added locking of lock mutex when updating status in external_unlock() for Aria and MyISAM tables.
Fixed that 'source' command doesn't cause mysql command line tool to exit on error.
DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards. (Allows one to run --debug with mysql-test-run scripts that uses @debug)
Fixed several core dump, deadlock and crashed table bugs in handling of LOCK TABLE with MERGE tables:
- Added priority of locks to avoid crashes with MERGE tables.
- Added thr_lock_merge() to allow one to merge two results of thr_lock().
Fixed 'not found row' bug in REPLACE with Aria tables.
Mark MyISAM tables that are part of MERGE with HA_OPEN_MERGE_TABLE and set the locks to have priority THR_LOCK_MERGE_PRIV.
- By sorting MERGE tables last in thr_multi_unlock() it's safer to release and relock them many times (can happen when TRIGGERS are created)
Avoid printing (null) in debug file (to easier find out wrong NULL pointer usage with %s).



client/mysql.cc:
  Fixed that 'source' command doesn't cause mysql command line tool to exit on error.
client/mysqltest.cc:
  Don't send NULL to fn_format(). (Can cause crash on Solaris when using --debug)
dbug/dbug.c:
  DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards.
include/my_base.h:
  Added flag to signal if one opens a MERGE table.
  Added extra() command to signal that one is not part of a MERGE table anymore.
include/thr_lock.h:
  Added priority for locks (needed to fix bug in thr_lock when using MERGE tables)
  Added option to thr_unlock() if get_status() should be called.
  Added prototype for thr_merge_locks().
mysql-test/mysql-test-run.pl:
  Ignore crashed table warnings for tables named 'crashed'.
mysql-test/r/merge.result:
  Renamed triggers to make debugging easier.
  Added some CHECK TABLES to catch errors earlier.
  Additional tests.
mysql-test/r/merge_debug.result:
  Test of error handling when reopening MERGE tables.
mysql-test/r/udf_query_cache.result:
  Added missing flush status
mysql-test/suite/parts/r/partition_repair_myisam.result:
  Update results
mysql-test/t/merge.test:
  Renamed triggers to make debugging easier.
  Added some CHECK TABLES to catch errors earlier.
  Additional tests.
mysql-test/t/merge_debug.test:
  Test of error handling when reopening MERGE tables.
mysql-test/t/udf_query_cache.test:
  Added missing flush status
mysys/my_getopt.c:
  Removed not used variable
mysys/my_symlink2.c:
  Changed (null) to (NULL) to make it easier to find NULL arguments to DBUG_PRINT() functions.
  (On linux, NULL to sprintf is printed 'null')
mysys/thr_lock.c:
  Added priority of locks to avoid crashes with MERGE tables.
  Added thr_lock_merge() to allow one to merge two results of thr_lock().
  - This is needed for MyISAM as all locked table must share the same status. If not, you will not see newly inserted rows in other instances of the table.
  If calling thr_unlock() with THR_UNLOCK_UPDATE_STATUS, call update_status() and restore_status() for the locks. This is needed in some rare cases where we call thr_unlock() followed by thr_lock() without calling external_unlock/external_lock in between.
  Simplify loop in thr_multi_lock().
  Added 'start_trans', which is called at end of thr_multi_lock() when all locks are taken.
  - This was needed by Aria to ensure that transaction is started when we got all locks, not at get_status(). Without this, some rows could not be visible when we lock two tables at the same time, causing REPLACE using two tables to fail unexpectedly.
sql/handler.cc:
  Add an assert() in handler::print_error() for "impossible errors" (like table is crashed) when --debug-assert-if-crashed-table is used.
sql/lock.cc:
  Simplify mysql_lock_tables() code if get_lock_data() returns 0 locks.
  Added new parameter to thr_multi_unlock()
  In mysql_unlock_read_tables(), call first externa_unlock(), then thr_multi_unlock();  This is same order as we do in mysql_unlock_tables().
  Don't abort locks in mysql_lock_abort() for merged tables when a MERGE table is deleted; Would cause a spin lock.
  Added call to thr_merge_locks() in mysql_lock_merge() to ensure consistency in thr_locks().
  - New locks of same type and table is stored after the old lock to ensure that we get the status from the original lock.
sql/mysql_priv.h:
  Added debug_assert_if_crashed_table
sql/mysqld.cc:
  Added --debug-assert-if-crashed-table
sql/parse_file.cc:
  Don't print '(null)' in DBUG_PRINT of no dir given
sql/set_var.cc:
  Increase default size of buffer for @debug variable.
sql/sql_base.cc:
  In case of error from reopen_table() in reopen_tables(), call unlock_open_table() and restart loop.
  - This fixed bug when we twice deleted same table from open_cache.
  Don't take name lock for already name locked table in open_unireg_entry().
  - Fixed bug when doing repair in reopen_table().
  - In detach_merge_children(), always detach if 'clear_refs' is given. We can't trust parent->children_attached as this function can be called twice, first time with clear_refs set to 0.
sql/sql_class.cc:
  Changed printing of (null) to "" in set_thd_proc_info()
sql/sql_parse.cc:
  Added DBUG
sql/sql_trigger.cc:
  Don't call unlink_open_table() if reopen_table() fails as the table may already be freed.
storage/maria/ma_bitmap.c:
  Fixed DBUG_ASSERT() in allocate_tail()
storage/maria/ma_blockrec.c:
  Fixed wrong calculation of row length for very small rows in undo_row_update().
  - Fixes ASSERT() when doing undo.
storage/maria/ma_blockrec.h:
  Added _ma_block_start_trans() and _ma_block_start_trans_no_versioning()
storage/maria/ma_locking.c:
  Call _ma_update_status_with_lock() when releasing write locks.
  - Fixes potential problem with updating status without the proper lock.
storage/maria/ma_open.c:
  Changed to use start_trans() instead of get_status() to ensure that we see all rows in all locked tables when we got the locks.
  - Fixed 'not found row' bug in REPLACE with Aria tables.
storage/maria/ma_state.c:
  Added _ma_update_status_with_lock() and _ma_block_start_trans().
  This is to ensure that we see all rows in all locked tables when we got the locks.
storage/maria/ma_state.h:
  Added _ma_update_status_with_lock()
storage/maria/ma_write.c:
  More DBUG_PRINT
storage/myisam/mi_check.c:
  Fixed error message
storage/myisam/mi_extra.c:
  Added HA_EXTRA_DETACH_CHILD:
  - Detach MyISAM table to not be part of MERGE table (remove flag & lock priority).
storage/myisam/mi_locking.c:
  Call mi_update_status_with_lock() when releasing write locks.
  - Fixes potential problem with updating status without the proper lock.
  Change to use new HA_OPEN_MERGE_TABLE flag to test if MERGE table.
  Added mi_fix_status(), called by thr_merge().
storage/myisam/mi_open.c:
  Added marker if part of MERGE table.
  Call mi_fix_status() in thr_lock() for transactional tables.
storage/myisam/myisamdef.h:
  Change my_once_flag to uint, as it stored different values than just 0/1
  Added 'open_flag' to store state given to mi_open()
storage/myisammrg/ha_myisammrg.cc:
  Add THR_LOCK_MERGE_PRIV to THR_LOCK_DATA to get MERGE locks sorted after other types of locks.
storage/myisammrg/myrg_locking.c:
  Remove windows specific code.
storage/myisammrg/myrg_open.c:
  Use HA_OPEN_MERGE_TABLE to mi_open().
  Set HA_OPEN_MERGE_TABLE for linked MyISAM tables.
storage/xtradb/buf/buf0buf.c:
  Fixed compiler warning
storage/xtradb/buf/buf0lru.c:
  Initialize variable that could be used not initialized.
2010-11-02 17:22:57 +02:00
Sergei Golubchik
74711a4615 merge w/ 5.2 2010-11-02 10:12:29 +01:00
Sergey Petrunya
7f059782d0 Merge MWL#121-124 DS-MRR support for key-ordered reads + MWL#128 BNL-Hash join 2010-11-01 20:43:02 +03:00
Sergey Petrunya
6c15806b68 MWL#121-124 DS-MRR support for key-ordered retrieval, etc
- Merge into 5.3-main
2010-11-01 18:49:59 +03:00
unknown
fb8244a57c Merge latest MariaDB 5.1 into MWL#116. 2010-11-01 15:41:09 +01:00
Igor Babaev
0b72fd88a1 Merge. 2010-10-30 06:07:45 -07:00
Sergei Golubchik
310584a849 merge w/ 5.1 2010-10-29 23:18:02 +02:00
Sergei Golubchik
716f784375 sane implementation of Key_% status variables. 2010-10-29 20:29:43 +02:00
Sergei Golubchik
8e7ebfbce8 5.2 merge 2010-10-28 19:04:23 +02:00
Igor Babaev
4f75a8254a Merge 5.3-mwl128 -> 5.3 2010-10-27 16:31:22 -07:00
Sergei Golubchik
04a4b43346 merge with 5.1 2010-10-25 15:21:16 +02:00
Sergei Golubchik
2e02037288 Show the number of warm keycache blocks in SHOW STATUS 2010-10-20 21:42:17 +02:00
Sergei Golubchik
da0603b690 fixed a bad merge 2010-10-19 18:11:30 +02:00
Sergei Golubchik
745cc74c33 5.1.51 merge 2010-10-19 15:58:35 +02:00
Igor Babaev
c27b3902a3 Merge from mariadb-5.1 (through mariadb-5.2) 2010-10-14 16:01:40 -07:00
Igor Babaev
3c9dcf9da7 Merge 2010-10-14 15:46:20 -07:00
Michael Widenius
01672cc026 Fixes for bugs found by running test case for LP#608369 "Page: 1 Found wrong page type 0' on CHECK TABLE EXTENDED"
Fixed overflow when using long --debug=xxxxxx line.
Fixed that "mysqld --disable-debug --debug" works.
Ensure that MariaDB doesn't start if the Aria engine didn't start and we are using Aria for temporary tables.
More DBUG_ASSERT() and more info in debug log.


dbug/dbug.c:
  Fixed crash in mysqld caused by an overflow when using long --debug=xxxxxx line
sql/mysqld.cc:
  Fixed that "mysqld --disable-debug --debug" works.
  Documented myisam-recover=OFF option
storage/maria/ha_maria.cc:
  Ensure that MariaDB doesn't start if the Aria engine didn't start and we are using Aria for temporary tables.
storage/maria/ma_delete.c:
  Added missing write of changed key on node page.
  This could fix LP#608369 "Page: 1 Found wrong page type 0' on CHECK TABLE EXTENDED"
  Changed so that we log page numbers (not positions)
  Added KEY_OP_DEBUG_2 log entry to get more debug information into the log
storage/maria/ma_key_recover.c:
  Changed so that we log page numbers (not positions)
  In case of wrong page information after index_redo, dump pages to debug log
storage/maria/ma_loghandler.h:
  Added KEY_OP_DEBUG_2
storage/maria/ma_search.c:
  Changed so that we log page numbers (not positions)
storage/maria/ma_write.c:
  Changed so that we log page numbers (not positions)
2010-10-13 18:15:43 +03:00
Sergey Petrunya
72dd7575cd Merge 5.2->5.3
- Re-commit Monty's merge, partially fixed by Igor and SergeyP, 
  but still broken
2010-10-10 17:18:11 +03:00
unknown
addd57828d MWL#89: Cost-based choice between Materialization and IN->EXISTS transformation
- Changed the default optimizer switches to provide 5.1/5.2 compatible behavior
- Added a regression test file to test consistently all cases covered by MWL#89
- Added/corrected/improved comments.
2010-10-09 17:48:05 +03:00
Davi Arnaut
f60106f82d Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix assorted compiler warnings.

sql/mysqld.cc:
  Do not declare max_page_size twice. If large pages support
  is enabled, the code expects the size in max_desired_page_size.
storage/innobase/include/ibuf0ibuf.h:
  Remove trailing comma. Only present in C99.
  
  Approved by: Vasil (via IRC)
storage/innobase/include/row0row.h:
  Remove trailing comma. Only present in C99.
  
  Approved by: Vasil (via IRC)
strings/my_vsnprintf.c:
  No need to assert the obvious.
2010-10-08 11:52:39 -03:00
Alexey Botchkov
5f318d4ad9 Bug#30025 Mysqld prints out warnings/errors being run with --no-defaults --help
now do no initializations for the --help.
        Do it for --verbose --help though.

per-file comments:
  sql/mysqld.cc
Bug#30025 Mysqld prints out warnings/errors being run with --no-defaults --help
        quit with the help message at once as --help was given
2010-10-08 12:12:18 +05:00
Alexander Nozdrin
985fa88f8b Fix for Bug#57094 (Copyright notice incorrect?).
The fix is to:
  - introduce ORACLE_WELCOME_COPYRIGHT_NOTICE define to have a single place
    to specify copyright notice;
  - replace custom copyright notices with ORACLE_WELCOME_COPYRIGHT_NOTICE
    in programs.
2010-10-06 19:06:13 +04:00
Georgi Kodinov
8789c79723 merge 2010-10-04 15:42:16 +03:00
Davi Arnaut
40ee088f68 Bug#57210: remove pstack
Quoting from the bug report:

The pstack library has been included in MySQL since version
4.0.0. It's useless and should be removed.

Details: According to its own documentation, pstack only works
on Linux on x86 in 32 bit mode and requires LinuxThreads and a
statically linked binary. It doesn't really support any Linux
from 2003 or later and doesn't work on any other OS.
2010-10-04 08:52:59 -03:00
unknown
498f10a2be Merge with latest MariaDB 5.1 2010-10-01 10:49:57 +02:00
unknown
8ec5e13f1f MWL#89: Cost-based choice between Materialization and IN->EXISTS transformation
Phase 3: Implementation of re-optimization of subqueries with injected predicates
           and cost comparison between Materialization and IN->EXISTS strategies.

The commit contains the following known problems:
- The implementation of EXPLAIN has not been re-engineered to reflect the
  changes in subquery optimization. EXPLAIN for subqueries is called during
  the execute phase, which results in different code paths during JOIN::optimize
  and thus in differing EXPLAIN messages for constant/system tables.
- There are some valgrind warnings that need investigation
- Several EXPLAINs with minor differences need to be reconsidered after fixing
  the EXPLAIN problem above.

This patch also adds one extra optimizer_switch: 'in_to_exists' for complete
manual control of the subquery execution strategies.
2010-09-30 18:32:44 +03:00
unknown
0394cf2030 MWL#116: Efficient group commit for binary log
Preliminary commit for testing
2010-09-30 15:20:15 +02:00
Michael Widenius
ca672e6b61 Automatic merge 2010-10-01 18:27:32 +03:00
Michael Widenius
255187b279 mysqld: Move --skip-new to --safe and remove old usage of --skip-new 2010-09-24 01:02:21 +03:00
Michael Widenius
5ce4825b63 Fix usage of mysqld option --new, --old, --safe and --skip_new to not disable things that are proven stable or enable things that are not usefull.
sql/field.cc:
  Remove feature of 'new_mode' that was never implemtented in a newer MySQL version.
sql/item_cmpfunc.cc:
  Boyer more is stable; Don't have to be protected by --skip-new anymore
sql/mysqld.cc:
  Don't disable some proven stable functions with --skip-new
sql/records.cc:
  Don't disable record caching with --safe-mode anymore
sql/sql_delete.cc:
  Do fast truncate even if --skip-new or --safe is used
sql/sql_parse.cc:
  Use always mysql_optimizer() for optimizer (instead of mysql_recreate_table() in case of --safe or --skip-new)
sql/sql_select.cc:
  Don't disable 'only_eq_ref_tables' if --safe is used.
sql/sql_yacc.yy:
  Removed not meaningfull test of --old
2010-09-23 19:30:44 +03:00
Georgi Kodinov
353739fdef merge of mysql-5.5 into mysql-5.5-wl1054 2010-09-20 17:17:32 +03:00
Marc Alff
5b9a2f3b69 Local merge 2010-09-14 15:40:50 -06:00
Sergei Golubchik
e246077bcf rename maria to aria 2010-09-12 18:40:01 +02:00
Sergei Golubchik
a3d80d952d merge with 5.1 2010-09-11 20:43:48 +02:00
Marc Alff
bb04ac9734 Bug#56324 Race Condition while shutting down MySQL: "PSI_server"
Before this fix, the server could crash during shutdown,
due to race conditions, that occured when killing the server.

In particular, the performance schema instrumentation handle,
PSI_server, and the performance schema itself would be cleaned up
too soon, causing race conditions with a running kill server thread.

The specifics of the race condition found are that:
the main thread executing "PSI_server= NULL" can cause crashes in
other threads still running, which are executing
"if (PSI_server != NULL) PSI_server->xxx()"
as part of the performance schema instrumentation.

While the bug was reported for the kill server thread,
in theory the same crash could happen with the signal thread,
as found by code analysis.

The correct fix would be to only shutdown the performance schema
and set PSI_server to NULL after every other thread is guaranteed
to be completed, including the kill_server_thread.

However, due to the existing mysqld server design, this is not the case.
See in particular bug number 56666.

The work around used to fix this race condition is to simply not
perform the call to shutdown_performance_schema() when the server exits,
and to keep the PSI_server pointer unchanged.

This will cause memory leaks to be reported by tools like valgrind,
but no memory leak actually happen because the process is about to exit().

As a result, the file mysql-test/valgrind.supp has been updated
to filter out these false positive messages.

This code has been tested with running in a loop the following
tests in parallel, which have been known to fail with race conditions
in the past:
- rpl_change_master
- binlog_max_extension
- events_restart
- rpl_heartbeat_basic
and no crash of test failure has been seen with the changed code.
2010-09-09 15:33:35 -06:00
Michael Widenius
01b100b5dd Give a more precise warning why something fails.
Fixed typo that caused warnings from mysql-test-run

mysql-test/mysql-test-run.pl:
  Fixed typo
sql/mysqld.cc:
  Give a more precise warning why something fails.
2010-09-08 02:00:12 +03:00
Michael Widenius
172356b081 Automatic merge 2010-09-07 23:57:00 +03:00
Michael Widenius
7027c7facc Added --skip-bdb as a compatibility option for old config files
mysql-test/mysql-test-run.pl:
  Added suppression
mysql-test/t/upgrade.test:
  Added missing path
2010-09-07 23:46:10 +03:00
Michael Widenius
89e62085c6 Fixed recovery bug where bitmap pages would not be correctly updated after processing UNDO rows.
Fixed test failures in buildbot
Don't write errors when failing to send ok packet

mysql-test/suite/pbxt/r/range.result:
  Don't write number of rows as it varies.
mysql-test/suite/pbxt/t/range.test:
  Don't write number of rows as it varies.
sql/mysqld.cc:
  Don't write errors when failing to send ok packet
storage/maria/ma_bitmap.c:
  Added DBUG_ASSERT to detect wrong bitmap pages
storage/maria/ma_blockrec.c:
  Don't reset BLOCKUSED_USE_ORG_BITMAP flag. This fixed a bug where bitmap could be wrong after UNDO of row with blobs
2010-09-07 19:58:39 +03:00
Michael Widenius
0f3d4b2f76 Fixed bug that 'maria_read_log -a' didn't set max_trid when reparing tables.
Fixed bug in Aria when replacing short keys with long keys and a key tree both overflow and underflow at same time.
Fixed several bugs when generating recovery logs when using RGQ with replacing long keys with short keys and vice versa.
Lots of new DBUG_ASSERT()'s
Added more information to recovery log to make it easier to know from where log entry orginated.
Introduced MARIA_PAGE->org_size that tells what the size of the page was in last log entry. This allows us to find out if all key changes for index page was logged.
Small code cleanups:
- Introduced _ma_log_key_changes() to log crc of key page changes
- Added share->max_index_block_size as max size of data one can put in key block (block_size - KEYPAGE_CHECKSUM_SIZE)
  This will later simplify adding a directory to index pages.
- Write page number instead of page postition to DBUG log



mysql-test/lib/v1/mysql-test-run.pl:
  Use --general-log instead of --log to disable warning when using RQG
sql/mysqld.cc:
  If we have already sent ok to client when we get an error, log this to stderr
  Don't disable option --log-output if CSV engine is not supported.
storage/maria/ha_maria.cc:
  Log queries to recovery log also in LOCK TABLES
storage/maria/ma_check.c:
  If param->max_trid is set, use this value instead of max_trid_in_system().
  This is used by recovery to set max_trid to max seen trid so far.
  keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE -> max_index_block_size (Style optimization)
storage/maria/ma_delete.c:
  Mark tables crashed early
  Write page number instead of page position to debug log.
  Added parameter to ma_log_delete() and ma_log_prefix() that is logged so that we can find where wrong log entries where generated.
  Fixed bug where a page was not proplerly written when same key tree had both an overflow and underflow when deleting a key.
  keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE => max_index_block_size (Style optimization)
  ma_log_delete() now has extra parameter of how many bytes from end of page should be appended to log for page (for page overflows)
storage/maria/ma_key_recover.c:
  Added extra parameter to ma_log_prefix() to indicate what caused log entry.
  Update MARIA_PAGE->org_size when logging info about page.
  Much more DBUG_ASSERT()'s.
  Fix some bugs in maria_log_add() to handle page overflows.
  Added _ma_log_key_changes() to log crc of key page changes.
  If EXTRA_STORE_FULL_PAGE_IN_KEY_CHANGES is defines, log the resulting pages to log so one can trivally
  see how the resulting page should have looked like (for errors in CRC values)
storage/maria/ma_key_recover.h:
  Added _ma_log_key_changes() which is only called if EXTRA_DEBUG_KEY_CHANGES is defined.
  Updated function prototypes.
storage/maria/ma_loghandler.h:
  Added more values to en_key_debug, to get more exact location where things went wrong when logging to recovery log.
storage/maria/ma_open.c:
  Initialize share->max_index_block_size
storage/maria/ma_page.c:
  Added updating and testing of MARIA_PAGE->org_size
  Write page number instead of page postition to DBUG log
  Generate error if we read page with wrong data.
  Removed wrong assert: key_del_current != share->state.key_del.
  Simplify _ma_log_compact_keypage()
storage/maria/ma_recovery.c:
  Set param.max_trid to max seen trid before running repair table (used for alter table to create index)
storage/maria/ma_rt_key.c:
  Update call to _ma_log_delete()
storage/maria/ma_rt_split.c:
  Use _ma_log_key_changes()
  Update MARIA_PAGE->org_size
storage/maria/ma_unique.c:
  Remove casts
storage/maria/ma_write.c:
  keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE => share->max_index_block_length.
  Updated calls to _ma_log_prefix()
  Changed code to use _ma_log_key_changes()
  Update ma_page->org_size
  Fixed bug in _ma_log_split() for pages that overflow
  Added KEY_OP_DEBUG logging to functions
  Log KEYPAGE_FLAG in all log entries
storage/maria/maria_def.h:
  Added SHARE->max_index_block_size
  Added MARIA_PAGE->org_size
storage/maria/trnman.c:
  Reset flags for new transaction.
2010-09-06 02:25:44 +03:00
Alexey Botchkov
c6024dfc4e Bug#53251 mysql_library_init fails on second execution with embedded library
thread-specific variables weren't set when we load error message files.

per-file comments:
  libmysqld/lib_sql.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
      we need to call my_thread_init() once more. Normally it's called at the my_init()
      stage but that doesn't happen on the second my_init() call.

  sql/derror.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
     use default errors for the embedded server.

  sql/mysqld.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
        unregister server errors in clean_up(). Without it the error list contains
        that on the second mysql_server_init() which is not good.

  sql/set_var.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
        sys_var::cleanup() call instead of the destructor

  sql/set_var.h
Bug#53251      mysql_library_init fails on second execution with embedded library
        sys_var::cleanup() introduced instead of the destructor
        
  sql/sys_vars.h
Bug#53251      mysql_library_init fails on second execution with embedded library
        Sys_var_charptr::cleanup() implemented
2010-09-02 23:37:04 +05:00
Igor Babaev
94cfcbd9df The main patch for MWL#128: Implement Block Nested Loop Hash Join. 2010-08-31 09:34:21 -07:00
Alexander Nozdrin
f0fe6e4dac Auto-merge from mysql-5.5-merge. 2010-08-30 18:07:40 +04:00
Alexander Nozdrin
9ab0759ea4 Auto-merge from mysql-5.5. 2010-08-30 12:36:02 +04:00
Michael Widenius
ad6d95d3cb Merge with MySQL 5.1.50
- Changed to still use bcmp() in certain cases becasue
  - Faster for short unaligneed strings than memcmp()
  - Bettern when using valgrind
- Changed to use my_sprintf() instead of sprintf() to get higher portability for old systems
- Changed code to use MariaDB version of select->skip_record()
- Removed -%::SCCS/s.% from Makefile.am:s to remove automake warnings
2010-08-27 17:12:44 +03:00
Marc Alff
257045499f Bug#52312 lost Handler_read_last status variable
Before this fix, the ha_read_last_count status variable was defined and
updated internally, for never exposed as a system variable.

This fix exposes the system variable as "Handler_read_last",
for completness of the Handler_read_* system variables interface.

Adjusted tests results accordingly.
2010-08-25 13:00:38 -06:00
Dmitry Shulga
e50d45e709 Auto-merge from mysql-5.1-bugteam 2010-08-25 18:39:38 +07:00
Dmitry Shulga
800feb16cb Fixed bug #29751 - do not rename the error log at FLUSH LOGS.
Added open log file with FILE_SHARE_DELETE flag on Windows.

sql/log.cc:
  added reopen_fstreams();
  modified redirect_std_streams(): call to sequence of freopen()
  replaced to reopen_fstreams();
  modified flush_error_log(): removed file rename for flushed
  error log file.
sql/mysqld.cc:
  modified main() and init_server_components(): do open log error file
  over call to reopen_fstreams().
2010-08-25 15:47:45 +07:00
Michael Widenius
58a75bb18b Automerge with 5.1 2010-08-25 01:44:50 +03:00
Mats Kindahl
b7ed981f37 Merging with mysql-5.5 2010-08-23 15:32:39 +02:00
Jon Olav Hauglid
02863b4180 Merge from mysql-5.5-runtime to mysql-5.5-bugfixing. 2010-08-20 10:24:32 +02:00
Alfranio Correia
ac6026ce27 BUG#53452 Inconsistent behavior of binlog_direct_non_transactional_updates with
temp table
            
This patch introduces two key changes in the replication's behavior.
            
Firstly, it reverts part of BUG#51894 which puts any update to temporary tables
into the trx-cache. Now, updates to temporary tables are handled according to
the type of their engines as a regular table.
            
Secondly, an unsafe mixed statement, (i.e. a statement that access transactional
table as well non-transactional or temporary table, and writes to any of them),
are written into the trx-cache in order to minimize errors in the execution when
the statement logging format is in use.
            
Such changes has a direct impact on which statements are classified as unsafe
statements and thus part of BUG#53259 is reverted.
2010-08-20 03:59:58 +01:00
Jon Olav Hauglid
eb498cce4d Manual merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-08-18 13:29:04 +02:00
Mats Kindahl
b0836bd309 Merging with mysql-5.5-stage. 2010-08-16 14:50:27 +02:00
Konstantin Osipov
8ce6e98aa3 Extract reload_acl_and_cache() and flush_tables_with_read_lock()
into an own implementation file.
2010-08-13 13:51:48 +04:00
Konstantin Osipov
29c4873ad5 Commit on behalf of Dmitry Lenev.
Merge his patch for Bug#52044 into 5.5, and apply 
review comments.
2010-08-12 17:50:23 +04:00
Michael Widenius
909e4eb08d Added verbose mode to recovery
More DBUG
Added convert-debug-for-diff
Added missing (from last push) federated test case

.bzrignore:
  Ignore generated files
mysql-test/README:
  Updated documentation for --extern
mysql-test/suite/federated/federated_bug_32426.result:
  Added test for federatedx
mysql-test/suite/federated/federated_bug_32426.test:
  Added test for federatedx
scripts/Makefile.am:
  Added convert-debug-for-diff
scripts/convert-debug-for-diff.sh:
  Added script for converting
sql/log.cc:
  Added DBUG
sql/mysqld.cc:
  Added DBUG
storage/maria/ma_recovery.c:
  If verbose, write dirty pages (for debugging)
storage/maria/ma_static.c:
  Added verbose mode to recovery
storage/maria/maria_def.h:
  Added verbose mode to recovery
storage/maria/maria_read_log.c:
  Added verbose mode to recovery
2010-08-18 10:52:57 +03:00
Michael Widenius
7cf5100412 Merge with 5.2
Fixed some compiler errors regarding longlong2str()

strings/longlong2str.c:
  Fixed usage of wrong variable
strings/longlong2str_asm.c:
  Fixed wrong prototype
2010-08-09 20:49:42 +03:00