Commit graph

7220 commits

Author SHA1 Message Date
Sergei Golubchik
e3f08e7e0b cleanup: remove unused init_dynamic_array and init_dynamic_array2 symbols,
as only my_init_dynamic_array and my_init_dynamic_array2 are used everywhere.
fix ha_cassandra to compile.
2013-01-23 16:18:53 +01:00
Sergei Golubchik
682da0aa75 cleanup: use MYF() for mysys flags 2013-01-23 16:18:09 +01:00
Michael Widenius
a260b15554 MDEV-4011 Added per thread memory counting and usage
Base code and idea from a patch from by plinux at Taobao.

The idea is that we mark all memory that are thread specific with MY_THREAD_SPECIFIC.
Memory counting is done per thread in the my_malloc_size_cb_func callback function from my_malloc().
There are plenty of new asserts to ensure that for a debug server the counting is correct.

Information_schema.processlist gets two new columns: MEMORY_USED and EXAMINED_ROWS.
- The later is there mainly to show how query is progressing.

The following changes in interfaces was needed to get this to work:
- init_alloc_root() amd init_sql_alloc() has extra option so that one can mark memory with MY_THREAD_SPECIFIC
- One now have to use alloc_root_set_min_malloc() to set min memory to be allocated by alloc_root()
- my_init_dynamic_array()  has extra option so that one can mark memory with MY_THREAD_SPECIFIC
- my_net_init() has extra option so that one can mark memory with MY_THREAD_SPECIFIC
- Added flag for hash_init() so that one can mark hash table to be thread specific.
- Added flags to init_tree() so that one can mark tree to be thread specific.
- Removed with_delete option to init_tree(). Now one should instead use MY_TREE_WITH_DELETE_FLAG.
- Added flag to Warning_info::Warning_info() if the structure should be fully initialized.
- String elements can now be marked as thread specific.
- Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC.
- Changed type of myf from int to ulong, as this is always a set of bit flags.

Other things:
- Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
- We now also show EXAMINED_ROWS in SHOW PROCESSLIST
- Added new variable 'memory_used'
- Fixed bug where kill_threads_for_user() was using the wrong mem_root to allocate memory.
- Removed calls to the obsoleted function init_dynamic_array()
- Use set_current_thd() instead of my_pthread_setspecific_ptr(THR_THD,...)


client/completion_hash.cc:
  Updated call to init_alloc_root()
client/mysql.cc:
  Updated call to init_alloc_root()
client/mysqlbinlog.cc:
  init_dynamic_array() -> my_init_dynamic_array()
  Updated call to init_alloc_root()
client/mysqlcheck.c:
  Updated call to my_init_dynamic_array()
client/mysqldump.c:
  Updated call to init_alloc_root()
client/mysqltest.cc:
  Updated call to init_alloc_root()
  Updated call to my_init_dynamic_array()
  Fixed compiler warnings
extra/comp_err.c:
  Updated call to my_init_dynamic_array()
extra/resolve_stack_dump.c:
  Updated call to my_init_dynamic_array()
include/hash.h:
  Added HASH_THREAD_SPECIFIC
include/heap.h:
  Added flag is internal temporary table.
include/my_dir.h:
  Safety fix: Ensure that MY_DONT_SORT and MY_WANT_STAT don't interfer with other mysys flags
include/my_global.h:
  Changed type of myf from int to ulong, as this is always a set of bit flags.
include/my_sys.h:
  Added MY_THREAD_SPECIFIC and MY_THREAD_MOVE
  Added malloc_flags to DYNAMIC_ARRAY
  Added extra mysys flag argument to my_init_dynamic_array()
  Removed deprecated functions init_dynamic_array() and my_init_dynamic_array.._ci
  Updated paramaters for init_alloc_root()
include/my_tree.h:
  Added my_flags to allow one to use MY_THREAD_SPECIFIC with hash tables.
  Removed with_delete. One should now instead use MY_TREE_WITH_DELETE_FLAG
  Updated parameters to init_tree()
include/myisamchk.h:
  Added malloc_flags to allow one to use MY_THREAD_SPECIFIC for checks.
include/mysql.h:
  Added MYSQL_THREAD_SPECIFIC_MALLOC
  Used 'unused1' to mark memory as thread specific.
include/mysql.h.pp:
  Updated file
include/mysql_com.h:
  Used 'unused1' to mark memory as thread specific.
  Updated parameters for my_net_init()
libmysql/libmysql.c:
  Updated call to init_alloc_root() to mark memory thread specific.
libmysqld/emb_qcache.cc:
  Updated call to init_alloc_root()
libmysqld/lib_sql.cc:
  Updated call to init_alloc_root()
mysql-test/r/create.result:
  Updated results
mysql-test/r/user_var.result:
  Updated results
mysql-test/suite/funcs_1/datadict/processlist_priv.inc:
  Update to handle new format of SHOW PROCESSLIST
mysql-test/suite/funcs_1/datadict/processlist_val.inc:
  Update to handle new format of SHOW PROCESSLIST
mysql-test/suite/funcs_1/r/is_columns_is.result:
  Update to handle new format of SHOW PROCESSLIST
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result:
  Updated results
mysql-test/suite/funcs_1/r/processlist_val_no_prot.result:
  Updated results
mysql-test/t/show_explain.test:
  Fixed usage of debug variable so that one can run test with --debug
mysql-test/t/user_var.test:
  Added test of memory_usage variable.
mysys/array.c:
  Added extra my_flags option to init_dynamic_array() and init_dynamic_array2() so that one can mark memory with MY_THREAD_SPECIFIC
  All allocated memory is marked with the given my_flags.
  Removed obsolete function init_dynamic_array()
mysys/default.c:
  Updated call to init_alloc_root()
  Updated call to my_init_dynamic_array()
mysys/hash.c:
  Updated call to my_init_dynamic_array_ci().
  Allocated memory is marked with MY_THREAD_SPECIFIC if HASH_THREAD_SPECIFIC is used.
mysys/ma_dyncol.c:
  init_dynamic_array() -> my_init_dynamic_array()
  Added #if to get rid of compiler warnings
mysys/mf_tempdir.c:
  Updated call to my_init_dynamic_array()
mysys/my_alloc.c:
  Added extra parameter to init_alloc_root() so that one can mark memory with MY_THREAD_SPECIFIC
  Extend MEM_ROOT with a flag if memory is thread specific.
  This is stored in block_size, to keep the size of the MEM_ROOT object identical as before.
  Allocated memory is marked with MY_THREAD_SPECIFIC if used with init_alloc_root()
mysys/my_chmod.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_chsize.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_copy.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_create.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_delete.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_error.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_fopen.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_fstream.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_getwd.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_lib.c:
  Updated call to init_alloc_root()
  Updated call to my_init_dynamic_array()
  Updated DBUG_PRINT because of change of myf type
mysys/my_lock.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_malloc.c:
  Store at start of each allocated memory block the size of the block and if the block is thread specific.
  Call malloc_size_cb_func, if set, with the memory allocated/freed.
  Updated DBUG_PRINT because of change of myf type
mysys/my_open.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_pread.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_read.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_redel.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_rename.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_seek.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_sync.c:
  Updated DBUG_PRINT because of change of myf type
mysys/my_thr_init.c:
  Ensure that one can call my_thread_dbug_id() even if thread is not properly initialized.
mysys/my_write.c:
  Updated DBUG_PRINT because of change of myf type
mysys/mysys_priv.h:
  Updated parameters to sf_malloc and sf_realloc()
mysys/safemalloc.c:
  Added checking that for memory marked with MY_THREAD_SPECIFIC that it's the same thread that is allocation and freeing the memory.
  Added sf_malloc_dbug_id() to allow MariaDB to specify which THD is handling the memory.
  Added my_flags arguments to sf_malloc() and sf_realloc() to be able to mark memory with MY_THREAD_SPECIFIC.
  Added sf_report_leaked_memory() to get list of memory not freed by a thread.
mysys/tree.c:
  Added flags to init_tree() so that one can mark tree to be thread specific.
  Removed with_delete option to init_tree(). Now one should instead use MY_TREE_WITH_DELETE_FLAG.
  Updated call to init_alloc_root()
  All allocated memory is marked with the given malloc flags
mysys/waiting_threads.c:
  Updated call to my_init_dynamic_array()
sql-common/client.c:
  Updated call to init_alloc_root() and my_net_init() to mark memory thread specific.
  Updated call to my_init_dynamic_array().
  Added MYSQL_THREAD_SPECIFIC_MALLOC so that client can mark memory as MY_THREAD_SPECIFIC.
sql-common/client_plugin.c:
  Updated call to init_alloc_root()
sql/debug_sync.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/event_scheduler.cc:
  Removed calls to net_end() as this is now done in ~THD()
  Call set_current_thd() to ensure that memory is assigned to right thread.
sql/events.cc:
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/filesort.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/filesort_utils.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/ha_ndbcluster.cc:
  Updated call to init_alloc_root()
  Updated call to my_net_init()
  Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
sql/ha_ndbcluster_binlog.cc:
  Updated call to my_net_init()
  Updated call to init_sql_alloc()
  Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
sql/ha_partition.cc:
  Updated call to init_alloc_root()
sql/handler.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
  Added missing call to my_dir_end()
sql/item_func.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/item_subselect.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/item_sum.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/log.cc:
  More DBUG
  Updated call to init_alloc_root()
sql/mdl.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/mysqld.cc:
  Added total_memory_used
  Updated call to init_alloc_root()
  Move mysql_cond_broadcast() before my_thread_end()
  Added mariadb_dbug_id() to count memory per THD instead of per thread.
  Added my_malloc_size_cb_func() callback function for my_malloc() to count memory.
  Move initialization of mysqld_server_started and mysqld_server_initialized earlier.
  Updated call to my_init_dynamic_array().
  Updated call to my_net_init().
  Call my_pthread_setspecific_ptr(THR_THD,...) to ensure that memory is assigned to right thread.
  Added status variable 'memory_used'.
  Updated call to init_alloc_root()
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/mysqld.h:
  Added set_current_thd()
sql/net_serv.cc:
  Added new parameter to my_net_init() so that one can mark memory with MY_THREAD_SPECIFIC.
  Store in net->thread_specific_malloc if memory is thread specific.
  Mark memory to be thread specific if requested.
sql/opt_range.cc:
  Updated call to my_init_dynamic_array()
  Updated call to init_sql_alloc()
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/opt_subselect.cc:
  Updated call to init_sql_alloc() to mark memory thread specific.
sql/protocol.cc:
  Fixed compiler warning
sql/records.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/rpl_filter.cc:
  Updated call to my_init_dynamic_array()
sql/rpl_handler.cc:
  Updated call to my_init_dynamic_array2()
sql/rpl_handler.h:
  Updated call to init_sql_alloc()
sql/rpl_mi.cc:
  Updated call to my_init_dynamic_array()
sql/rpl_tblmap.cc:
  Updated call to init_alloc_root()
sql/rpl_utility.cc:
  Updated call to my_init_dynamic_array()
sql/slave.cc:
  Initialize things properly before calling functions that allocate memory.
  Removed calls to net_end() as this is now done in ~THD()
sql/sp_head.cc:
  Updated call to init_sql_alloc()
  Updated call to my_init_dynamic_array()
  Added parameter to warning_info() that it should be fully initialized.
sql/sp_pcontext.cc:
  Updated call to my_init_dynamic_array()
sql/sql_acl.cc:
  Updated call to init_sql_alloc()
  Updated call to my_init_dynamic_array()
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/sql_admin.cc:
  Added parameter to warning_info() that it should be fully initialized.
sql/sql_analyse.h:
  Updated call to init_tree() to mark memory thread specific.
sql/sql_array.h:
  Updated call to my_init_dynamic_array() to mark memory thread specific.
sql/sql_audit.cc:
  Updated call to my_init_dynamic_array()
sql/sql_base.cc:
  Updated call to init_sql_alloc()
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/sql_cache.cc:
  Updated comment
sql/sql_class.cc:
  Added parameter to warning_info() that not initialize it until THD is fully created.
  Updated call to init_sql_alloc()
  Mark THD::user_vars has to be thread specific.
  Updated call to my_init_dynamic_array()
  Ensure that memory allocated by THD is assigned to the THD.
  More DBUG
  Always acll net_end() in ~THD()
  Assert that all memory signed to this THD is really deleted at ~THD.
  Fixed set_status_var_init() to not reset memory_used.
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/sql_class.h:
  Added MY_THREAD_SPECIFIC to allocated memory.
  Added malloc_size to THD to record allocated memory per THD.
sql/sql_delete.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/sql_error.cc:
  Added 'initialize' parameter to Warning_info() to say if should allocate memory for it's structures.
  This is used by THD::THD() to not allocate memory until THD is ready.
  Added Warning_info::free_memory()
sql/sql_error.h:
  Updated Warning_info() class.
sql/sql_handler.cc:
  Updated call to init_alloc_root() to mark memory thread specific.
sql/sql_insert.cc:
  More DBUG
sql/sql_join_cache.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/sql_lex.cc:
  Updated call to my_init_dynamic_array()
sql/sql_lex.h:
  Updated call to my_init_dynamic_array()
sql/sql_load.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/sql_parse.cc:
  Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
  Ensure that examined_row_count() is reset before query.
  Fixed bug where kill_threads_for_user() was using the wrong mem_root to allocate memory.
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
  Don't restore thd->status_var.memory_used when restoring thd->status_var
sql/sql_plugin.cc:
  Updated call to init_alloc_root()
  Updated call to my_init_dynamic_array()
  Don't allocate THD on the stack, as this causes problems with valgrind when doing thd memory counting.
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/sql_prepare.cc:
  Added parameter to warning_info() that it should be fully initialized.
  Updated call to init_sql_alloc() to mark memory thread specific.
sql/sql_reload.cc:
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/sql_select.cc:
  Updated call to my_init_dynamic_array() and init_sql_alloc() to mark memory thread specific.
  Added MY_THREAD_SPECIFIC to allocated memory.
  More DBUG
sql/sql_servers.cc:
  Updated call to init_sql_alloc() to mark memory some memory thread specific.
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/sql_show.cc:
  Updated call to my_init_dynamic_array()
  Mark my_dir() memory thread specific.
  Use my_pthread_setspecific_ptr(THR_THD,...) to mark that allocated memory should be allocated to calling thread.
  More DBUG.
  Added malloc_size and examined_row_count to SHOW PROCESSLIST.
  Added MY_THREAD_SPECIFIC to allocated memory.
  Updated call to init_sql_alloc()
  Added parameter to warning_info() that it should be fully initialized.
sql/sql_statistics.cc:
  Fixed compiler warning
sql/sql_string.cc:
  String elements can now be marked as thread specific.
sql/sql_string.h:
  String elements can now be marked as thread specific.
sql/sql_table.cc:
  Updated call to init_sql_alloc() and my_malloc() to mark memory thread specific
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
  Fixed compiler warning
sql/sql_test.cc:
  Updated call to my_init_dynamic_array() to mark memory thread specific.
sql/sql_trigger.cc:
  Updated call to init_sql_alloc()
sql/sql_udf.cc:
  Updated call to init_sql_alloc()
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/sql_update.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
sql/table.cc:
  Updated call to init_sql_alloc().
  Mark memory used by temporary tables, that are not for slave threads, as MY_THREAD_SPECIFIC
  Updated call to init_sql_alloc()
sql/thr_malloc.cc:
  Added my_flags argument to init_sql_alloc() to be able to mark memory as MY_THREAD_SPECIFIC.
sql/thr_malloc.h:
  Updated prototype for init_sql_alloc()
sql/tztime.cc:
  Updated call to init_sql_alloc()
  Updated call to init_alloc_root() to mark memory thread specific.
  my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
sql/uniques.cc:
  Updated calls to init_tree(), my_init_dynamic_array() and my_malloc() to mark memory thread specific.
sql/unireg.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
storage/csv/ha_tina.cc:
  Updated call to init_alloc_root()
storage/federated/ha_federated.cc:
  Updated call to init_alloc_root()
  Updated call to my_init_dynamic_array()
  Ensure that memory allocated by fedarated is registered for the system, not for the thread.
storage/federatedx/federatedx_io_mysql.cc:
  Updated call to my_init_dynamic_array()
storage/federatedx/ha_federatedx.cc:
  Updated call to init_alloc_root()
  Updated call to my_init_dynamic_array()
storage/heap/ha_heap.cc:
  Added MY_THREAD_SPECIFIC to allocated memory.
storage/heap/heapdef.h:
  Added parameter to hp_get_new_block() to be able to do thread specific memory tagging.
storage/heap/hp_block.c:
  Added parameter to hp_get_new_block() to be able to do thread specific memory tagging.
storage/heap/hp_create.c:
  - Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC.
  - Use MY_TREE_WITH_DELETE instead of removed option 'with_delete'.
storage/heap/hp_open.c:
  Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC.
storage/heap/hp_write.c:
  Added new parameter to hp_get_new_block()
storage/maria/ma_bitmap.c:
  Updated call to my_init_dynamic_array()
storage/maria/ma_blockrec.c:
  Updated call to my_init_dynamic_array()
storage/maria/ma_check.c:
  Updated call to init_alloc_root()
storage/maria/ma_ft_boolean_search.c:
  Updated calls to init_tree() and init_alloc_root()
storage/maria/ma_ft_nlq_search.c:
  Updated call to init_tree()
storage/maria/ma_ft_parser.c:
  Updated call to init_tree()
  Updated call to init_alloc_root()
storage/maria/ma_loghandler.c:
  Updated call to my_init_dynamic_array()
storage/maria/ma_open.c:
  Updated call to my_init_dynamic_array()
storage/maria/ma_sort.c:
  Updated call to my_init_dynamic_array()
storage/maria/ma_write.c:
  Updated calls to my_init_dynamic_array() and init_tree()
storage/maria/maria_pack.c:
  Updated call to init_tree()
storage/maria/unittest/sequence_storage.c:
  Updated call to my_init_dynamic_array()
storage/myisam/ft_boolean_search.c:
  Updated call to init_tree()
  Updated call to init_alloc_root()
storage/myisam/ft_nlq_search.c:
  Updated call to init_tree()
storage/myisam/ft_parser.c:
  Updated call to init_tree()
  Updated call to init_alloc_root()
storage/myisam/ft_stopwords.c:
  Updated call to init_tree()
storage/myisam/mi_check.c:
  Updated call to init_alloc_root()
storage/myisam/mi_write.c:
  Updated call to my_init_dynamic_array()
  Updated call to init_tree()
storage/myisam/myisamlog.c:
  Updated call to init_tree()
storage/myisam/myisampack.c:
  Updated call to init_tree()
storage/myisam/sort.c:
  Updated call to my_init_dynamic_array()
storage/myisammrg/ha_myisammrg.cc:
  Updated call to init_sql_alloc()
storage/perfschema/pfs_check.cc:
  Rest current_thd
storage/perfschema/pfs_instr.cc:
  Removed DBUG_ENTER/DBUG_VOID_RETURN as at this point my_thread_var is not allocated anymore, which can cause problems.
support-files/compiler_warnings.supp:
  Disable compiler warning from offsetof macro.
2013-01-23 16:16:14 +01:00
Jani Tolonen
09665bfd0e MDEV-3931 Cassandra SE packaging
Added autodetection for thrift library and includes
Added Cassandra Storage Engine rpm
2013-01-23 15:52:59 +01:00
Olivier Bertrand
5c8c4f4f8e Test for CSV file imported from Windows. 2013-01-23 00:36:00 +01:00
Alexander Barkov
a8f0f93a2a A Changeset from Olivier:
Added some #if define(... for WIN32, ODBC and MYSQL in case they not defined.

modified:
  storage/connect/ha_connect.cc
2013-01-22 20:08:22 +04:00
Alexander Barkov
bb6b87fdcf Fixing CMakeLists.txt:
- Olivier's changes for Linux/Windows
- Splitting cmake code by feature
2013-01-22 19:36:47 +04:00
Alexander Barkov
37465ea2fe Adding an Olivier's changeset:
pre_create function and one is now able to create table
without giving the column specifications for tables of types:
DBF, ODBC, MYSQL, CSV, and WMI (on Windows)

modified:
  sql/handler.h
  sql/sql_table.cc
  storage/connect/ha_connect.cc
  storage/connect/ha_connect.h
  storage/connect/mycat.cc
  storage/connect/odbconn.cpp
  storage/connect/plgcnx.h
  storage/connect/tabfmt.cpp
  storage/connect/tabmysql.cpp
  storage/connect/tabwmi.cpp
2013-01-22 18:14:34 +04:00
Alexander Barkov
2e175a4652 Automatic detection for LIBXML2 and ODBC includes/libraries. 2013-01-22 17:26:12 +04:00
Sergei Golubchik
7925bf6b40 MDEV-4069 thd_wait_end does not called in some cases in buf_page_read_low in XtraDB engine 2013-01-21 12:20:54 +01:00
Sergei Golubchik
d41d43f421 MDEV-4065 thd_kill_statement service 2013-01-18 19:04:23 +01:00
Alexander Barkov
d7143a4160 Adding the CONNECT storage engine sources. 2013-01-18 19:21:44 +04:00
unknown
3546644220 Fix missing #include 2013-01-16 16:12:50 +01:00
Sergei Golubchik
cf013ff949 xtradb merge. Percona-Server-5.5.28-rel29.3 2013-01-16 11:13:08 +01:00
Sergei Golubchik
d3935adf7a mysql-5.5.29 merge 2013-01-15 19:13:32 +01:00
Sergei Golubchik
aca8e7ed6b 5.3 merge 2013-01-15 19:07:46 +01:00
Sergei Golubchik
750b9147fc remove thd_mark_as_hard_kill()
(because it's conceptually wrong. only the user can decide whether the kill is
allowed to leave tables in the inconsistent state, storage engine has no say in that)
2013-01-15 17:46:46 +01:00
Elena Stepanova
7269530938 MDEV-3990: engine tests went out of sync with current MariaDB code
Reasons:
  alter_tablespace.rdiff: 
  tc_rename_error.result:
    from monty@askmonty.org-20120529213755-876ptdhhaj0t7l8r 
    (Added text for errno in error messages)
  insert_time.result:
    from sergii@pisem.net-20120908101555-37w00eyfrd9noc06 
    (MDEV-457 - Inconsistent data truncation)
  misc.result:
    from igor@askmonty.org-20130109033433-5awdv0w6vbpigltw
    (MDEV-3806/mwl248 - Engine independent statistics)
  tbl_opt_row_format.rdiff:
    from monty@askmonty.org-20120706161018-y5teinbuqpchle2m
    (Fixed wrong error codes)
  vcol.rdiff:  
    sergii@pisem.net-20121217100039-ikj1820nrku7p6d5
    (simplify the handler api)
2013-01-13 17:01:34 +04:00
Igor Babaev
1ef07d0845 Merge 10.0-base -> 10.0.
Also fixed a bug in sql_update.cc: the code of mysql_update() lacked
a call of set_statistics_for_table().
2013-01-10 22:33:23 -08:00
Michael Widenius
5f68820cd4 Fixed problem with failing mysql_upgrade when proc table was not correct.
Moved out creation of performance schema tables from mysql_system_tables.sql as
the performance_tables creation scripts needs a working mysql.proc to work.

client/mysql_upgrade.c:
  Added option -V, --version
debian/dist/Debian/mariadb-server-5.5.files:
  Added mysql_performance_tables.sql
debian/dist/Ubuntu/mariadb-server-5.5.files:
  Added mysql_performance_tables.sql
mysql-test/lib/v1/mysql-test-run.pl:
  Added mysql_performance_tables.sql
mysql-test/mysql-test-run.pl:
  Added mysql_performance_tables.sql
scripts/CMakeLists.txt:
  Moved out creation of performance schema tables from mysql_system_tables.sql 
  as the performance_tables creation scripts needs a working mysql.proc to work
scripts/mysql_install_db.sh:
  Added mysql_performance_tables.sql
scripts/mysql_performance_tables.sql:
  Moved out creation of performance schema tables from mysql_system_tables.sql 
  as the performance_tables creation scripts needs a working mysql.proc to work
scripts/mysql_system_tables.sql:
  Move creation of performance schema tables to mysql_performance_tables.sql
  Added 'flush tables' to get things to work if someone deletes a table like mysql.proc before run
scripts/mysql_system_tables_fix.sql:
  ove performance table things to mysql_performance_tables.sql
storage/perfschema/pfs.cc:
  Fixed comment
2013-01-11 00:53:07 +02:00
Michael Widenius
6e9a48b67f Fixed some race conditons and bugs related to killed queries
KILL now breaks locks inside InnoDB
Fixed possible deadlock when running INNODB STATUS
Added ha_kill_query() and kill_query() to send kill signal to all storage engines
Added reset_killed() to ensure we don't reset killed state while awake() is getting called


include/mysql/plugin.h:
  Added thd_mark_as_hard_kill()
include/mysql/plugin_audit.h.pp:
  Added thd_mark_as_hard_kill()
include/mysql/plugin_auth.h.pp:
  Added thd_mark_as_hard_kill()
include/mysql/plugin_ftparser.h.pp:
  Added thd_mark_as_hard_kill()
sql/handler.cc:
  Added ha_kill_query() to send kill signal to all storage engines
sql/handler.h:
  Added ha_kill_query() and kill_query() to send kill signal to all storage engines
sql/log_event.cc:
  Use reset_killed()
sql/mdl.cc:
  use thd->killed instead of thd_killed() to abort on soft kill
sql/sp_rcontext.cc:
  Use reset_killed()
sql/sql_class.cc:
  Fixed possible deadlock in INNODB STATUS by not getting thd->LOCK_thd_data if it's locked.
  Use reset_killed()
  Tell storge engines that KILL has been sent
sql/sql_class.h:
  Added reset_killed() to ensure we don't reset killed state while awake() is getting called.
  Added mark_as_hard_kill()
sql/sql_insert.cc:
  Use reset_killed()
sql/sql_parse.cc:
  Simplify detection of killed queries.
  Use reset_killed()
sql/sql_select.cc:
  Use reset_killed()
sql/sql_union.cc:
  Use reset_killed()
storage/innobase/handler/ha_innodb.cc:
  Added innobase_kill_query()
  Fixed error reporting for interrupted queries.
storage/xtradb/handler/ha_innodb.cc:
  Added innobase_kill_query()
  Fixed error reporting for interrupted queries.
2013-01-11 00:22:14 +02:00
Sergei Golubchik
4f67a14700 5.2->5.3 merge 2013-01-10 15:40:21 +01:00
Sergei Golubchik
bd87fed1dc 5.1 merge 2013-01-10 13:54:04 +01:00
unknown
0a5312dc2f Make cassandra not built by default 2013-01-10 01:01:15 +02:00
unknown
f54a4819b6 Cassandra SE merge 2013-01-10 00:58:36 +02:00
Sergei Golubchik
2e11ca36f2 mysql-5.1.67 merge 2013-01-09 23:51:51 +01:00
unknown
363436ede1 Make cassandra module and do not load it by default. 2013-01-10 00:07:44 +02:00
unknown
655e304531 MDEV-4005 fix.
Field matching fixed.
DBUG_ASSERT fixed.
2013-01-09 08:10:48 +02:00
Igor Babaev
f853333e09 Merge 5.5-mwl248 -> 10.0-base 2013-01-08 19:34:33 -08:00
Igor Babaev
7d9df8075e Merge 5.5 -> mwl248 2013-01-08 15:04:14 -08:00
Sergei Golubchik
a128c50ac1 MDEV-3883 Show global status not in order 2013-01-08 21:23:40 +01:00
Satya Bodapati
1dbc62ce2e Post Fix to Bug#14628410 - ASSERTION `! IS_SET()' FAILED IN
DIAGNOSTICS_AREA::SET_OK_STATUS

Use DBUG_RETURN() instead of return() if DBUG_ENTER() is
used in the function. This patch is to  fix the Windows 
pb2 failure on mysql-5.1

Approved by Marko. rb#1792
2013-01-07 16:56:16 +05:30
Vladislav Vaintroub
ac45f3b38a Remove timed mutexes in XtraDB - obsolete feature that does not link on Windows, if plugin is build dynamically
It was already  removed from innobase in the past.
2013-01-05 23:52:25 +01:00
Satya Bodapati
d95914b648 Merge Post Fix for BUG#14628410 from mysql-5.1 to mysql-5.5 2013-01-04 17:34:02 +05:30
Satya Bodapati
eab9f8f4f4 Post Fix to Bug#14628410 - ASSERTION `! IS_SET()' FAILED IN
DIAGNOSTICS_AREA::SET_OK_STATUS

Test fails on 5.1 valgrind build. This is because of close(-1)
system call.

Fixed by adding extra checks for valid file descriptor.

Approved by Vasil(Calvin). rb#1792
2013-01-04 17:30:39 +05:30
Marc Alff
cc2df0069d Bug#16060864 SEGMENTATION FAULT IN PERFORMANCE_SCHEMA WITH HISTORY SIZE 0
Before this fix, configuring the server with:
- performance_schema_events_waits_history_size=0
- performance_schema_events_waits_history_long_size=0
could cause a crash in the performance schema.

These settings to 0 are intended to be valid and supported,
and are in fact working properly in mysql 5.6 and up already.

This fix backports the code fix and test cases from mysql 5.6
to the mysql 5.5 release.
2013-01-02 11:00:55 +01:00
Sergey Petrunya
ffd5f8c8d4 Post-merge fixes:
- update ha_cassandra::start_bulk_insert() definition to match those in class handler.
2012-12-24 08:36:22 +04:00
unknown
61412c0c31 pre-merge 2012-12-23 23:37:11 +02:00
unknown
40ae63dd65 backport to 5.5 dyncol changes and names support 2012-12-23 20:57:54 +02:00
Igor Babaev
88b59efef6 Merge mdev539->10.0-base. 2012-12-20 15:38:29 -08:00
Igor Babaev
ca2cdaad86 The patch for the task mdev-539.
The patch lifts the limitation of the current implementation
of ALTER TABLE that does not allow to build unique/primary
indexes by sort for MyISAM and Aria engines.
2012-12-20 10:58:40 -08:00
Annamalai Gurusami
c162202ac0 Bug #13819630 ARCHIVE TABLE WITH 1000+ PARTITIONS CRASHES SERVER
ON "DROP TABLE"

In the function ha_archive::write_row(), there is an error code path
that exits the function without releasing the mutex that was acquired
earlier.  

rb#1743 approved by ramil.
2012-12-20 19:26:20 +05:30
Sergey Petrunya
28c9e1a550 Cassandra Storage Engine: Address review feedback part #3
- Cleanup ha_cassandra::store_lock()
- Remove dummy ha_cassandra::delete_table()
- Add HA_TABLE_SCAN_ON_INDEX to table_flags()
2012-12-20 14:30:09 +04:00
Sergey Petrunya
6b47b2fe98 Cassandra Storage Engine: Address review feedback part # 2
- Register counters directly in the array passed to maria_declare_plugin. As 
  a consequence, FLUSH TABLES will reset the counters.
- Update test results accordingly.
2012-12-20 14:15:56 +04:00
Sergey Petrunya
7e5ef40779 Cassandra Storage Engine:
- Partially address review feedback.
- Update cassandra.test result result
- make cassandra.test timezone-agnostic
2012-12-20 13:10:09 +04:00
Annamalai Gurusami
c7fd61814f Bug #14556349 RENAME OF COMPRESSED TABLE AND INSERT BUFFER MERGE CAUSE
HANG

Problem Statement:

When the operation RENAME TABLE is about rename the tablespace of the
table, it will stop all i/o operations on the tablespace temporarily.
For this the fil_space_t::stop_ios member is used.

Once the fil_space_t::stop_ios member is set to TRUE in the RENAME
TABLE operation, it is expected that no new i/o operation will be done
on the tablespace and all pending i/o operation can be completed on
the tablespace.

If the pending i/o operations initiate any new i/o operations then
there will be deadlock.  The RENAME TABLE operation will be waiting
for pending i/o on the tablespace to be completed, and the pending i/o
operations will be waiting on the RENAME TABLE operation to set the
file_space_t::stop_ios flag to be set to FALSE.

But in the given scenario the pending i/o operations did not initiate
new i/o.  But they where still unnecessarily checking the
fil_space_t::stop_ios flag.  This resulted in deadlock.

Solution:

I noticed that this deadlock happens in fil_space_get_size() and
fil_space_get_zip_size() in the i/o threads.  These functions check
the stop_ios flag even when no i/o will be initiated.  I modified
these functions to ensure that they check the stop_ios flag only when
they will be initiating an i/o operation.  This solves the problem.

rb://1635 (mysql-5.5)
rb://1660 (mysql-trunk) approved by Inaam, Jimmy, and ima.
2012-12-20 11:59:36 +05:30
Igor Babaev
f6636852c4 Merge mwl248->10.0-base. 2012-12-19 19:15:51 -08:00
Vasil Dimov
d485482a5f Fix Bug#16021177 DICT_LOAD_FOREIGNS() PASSES UNALIGNED MEMORY TO
DTUPLE_CREATE_FROM_MEM()

Align to word-size the memory occupied by tuple_buf[] memory chunk.
I confirm that this change fixes the SIGBUS on Solaris.

Approved by:	Marko (via IM)
2012-12-19 13:46:00 +02:00
unknown
5fe8e9f244 After-merge fixes for merge 10.0-base -> 10.0. 2012-12-18 22:03:53 +01:00
Vasil Dimov
e8ec0212bb Merge mysql-5.1 -> mysql-5.5 2012-12-18 21:02:56 +02:00
Vasil Dimov
0dd066cb6f Fix Bug#16000909 MEMORY LEAK, MYSQL_INPLACE_ALTER_TABLE
This is a followup to the fix of
Bug#14628410 ASSERTION `! IS_SET()' FAILED IN DIAGNOSTICS_AREA::SET_OK_STATUS
(satya.bodapati@oracle.com-20121213132316-5joz4phltx9yhjs7)

In innobase_mysql_tmpfile(): allocate/open the file after
the return(-1); statement.
2012-12-18 20:55:30 +02:00
Vasil Dimov
5395f4a597 Merge mysql-5.1 -> mysql-5.5 2012-12-18 16:52:58 +02:00
Vasil Dimov
7bdd8b481c Fix Bug#13463493 INNODB PLUGIN WERE CHANGED, BUT STILL USE THE
SAME VERSION NUMBER 1.0.17

Now that InnoDB/InnoDB Plugin is no longer separately developed and
distributed from the MySQL server it does not need its own version number.
Thus use the MySQL version instead.

"Removing" the version altogether is not feasible because the config
variable 'innodb_version' cannot be removed in GA branches.

Reviewed by:	Marko (rb#1751)
2012-12-18 16:51:41 +02:00
unknown
701419b02f Merge MariaDB 10.0-base to MariaDB 10.0 2012-12-18 15:01:58 +01:00
Sergei Golubchik
cb7f5948ec simplify the handler api - table_type() is no longer abstract, not even virtual 2012-12-17 11:00:39 +01:00
Igor Babaev
1b62f0f58c Merge maria-5.5-mwl248 -> 10.0-base. 2012-12-16 21:33:17 -08:00
Igor Babaev
7760efad74 Merge mariadb-5.5 -> 10.0-base. 2012-12-16 16:49:19 -08:00
unknown
40bbf697aa MDEV-532: Async InnoDB commit checkpoint.
Make the commit checkpoint inside InnoDB be asynchroneous.
Implement a background thread in binlog to do the writing and flushing of
binlog checkpoint events to disk.
2012-12-14 15:38:07 +01:00
Inaam Rana
117e2d1b6b Bug#14329288 IS THE CALL TO IBUF_MERGE_OR_DELETE_FOR_PAGE FROM
BUF_PAGE_GET_GEN REDUNDANT?

rb://1711
approved by: Marko Makela

When decompressing a compressed page that had already been accessed
in the buffer pool, do not attempt to merge buffered changes.
2012-12-14 11:24:57 +05:00
Satya Bodapati
b0213a2b3a Bug#14628410 - ASSERTION `! IS_SET()' FAILED IN DIAGNOSTICS_AREA::SET_OK_STATUS
The error code returned from Merge file/Temp file creation functions are
ignored.

Use the return codes of the row_merge_file_create() and innobase_mysql_tmpfile()
to return the error to caller if file creation fails.

Approved by Marko. rb#1618
2012-12-13 18:53:16 +05:30
Annamalai Gurusami
d426504b9e Bug #14200010 NEWLY CREATED TABLE DOESN'T ALLOW FOR LOOSE INDEX SCANS
Problem:

Before the ALTER TABLE statement, the array
dict_index_t::stat_n_diff_key_vals had proper values calculated
and updated.  But after the ALTER TABLE statement, all the values
of this array is 0.  

Because of this statistics returned by innodb_rec_per_key() is
different before and after the ALTER TABLE statement. Running the
ANALYZE TABLE command populates the statistics correctly.

Solution:

After ALTER TABLE statement, set the flag dict_table_t::stat_initialized
correctly so that the table statistics will be recalculated properly when
the table is next loaded.  But note that we still don't choose the loose
index scans.  This fix only ensures that an ALTER TABLE does not change
the optimizer plan.

rb://1639 approved by Marko and Jimmy.
2012-12-11 10:11:24 +05:30
Bill Qu
c3e918ea90 Approved by Jimmy and Inaam. rb#1576 2012-12-17 23:13:46 +08:00
Inaam Rana
7d9836f76e merge from 5.1 2012-12-14 11:29:07 +05:00
Marko Mäkelä
c85f51f92a Follow-up fix to Bug#14628410: Remove the Windows InnoDB Plugin specific
implementation of innobase_mysql_tmpfile() from MySQL 5.5 onwards.
2012-12-13 17:12:21 +02:00
Satya Bodapati
bf42e842e5 Merge fix for Bug#14628410 from mysql-5.1 to mysql-5.5 2012-12-13 18:56:47 +05:30
Annamalai Gurusami
2f7295575d Merging from mysql-5.1 to mysql-5.5. 2012-12-11 10:51:24 +05:30
Igor Babaev
109c104d07 Addressed the following issue from the review of the patch for
engine-independent statistics.
If a table was created for InnoDB then the execution of the
ANALYZE command over this table blocked any INSERT/DELETE/UPDATE
of the table.
2012-12-09 21:33:08 -08:00
Yasufumi Kinoshita
859ff1ec36 UNIV_DEBUG build of some environments needs
#include "read0read.h"
for srv0srv.c and trx0rec.c.
This is only for mysql-5.5
2012-12-04 12:32:58 +09:00
Inaam Rana
a418755a1a merge from 5.1 2012-11-30 16:28:58 +05:00
Inaam Rana
60fff18d77 Reverting fix for bug#14329288
revid that is being reverted: marko.makela@oracle.com-20121128070024-hb56t41limja8edz
2012-11-30 16:19:30 +05:00
Yasufumi Kinoshita
ddf518c567 Bug#59354 : Bug #12659252 : ASSERT !OTHER_LOCK AT LOCK_REC_ADD_TO_QUEUE DURING A DELETE OPERATION
The converted implicit lock should wait for the prior conflicting lock if found.

rb://1437 approved by Marko
2012-11-28 17:07:02 +09:00
Yasufumi Kinoshita
8dd87e690d Bug#59354 : Bug #12659252 : ASSERT !OTHER_LOCK AT LOCK_REC_ADD_TO_QUEUE DURING A DELETE OPERATION
The converted implicit lock should wait for the prior conflicting lock if found.

rb://1437 approved by Marko
2012-11-28 17:05:23 +09:00
Marko Mäkelä
cfebb6459d Merge mysql-5.1 to mysql-5.5. 2012-11-28 09:03:37 +02:00
Marko Mäkelä
112a93a7c8 Bug#14329288 IS THE CALL TO IBUF_MERGE_OR_DELETE_FOR_PAGE FROM
BUF_PAGE_GET_GEN REDUNDANT?

buf_page_get_gen(): When decompressing a compressed page that had
already been accessed in the buffer pool, do not attempt to merge
buffered changes.

rb:1602 approved by Inaam Rana
2012-11-28 09:00:24 +02:00
Sergei Golubchik
980664bf23 mysql-test: sys_vars stub for a new xtradb config variable; tc_log_mmap test; 2012-11-26 18:50:29 +01:00
Yasufumi Kinoshita
718de371c1 Bug #14676249 : ROW_VERS_IMPL_X_LOCKED_LOW() MIGHT HIT !BPAGE->FILE_PAGE_WAS_FREED ASSERTION
trx_undo_prev_version_build() should confirm existence of inherited (not-own) external pages.

Bug #14676084 : ROW_UNDO_MOD_UPD_DEL_SEC() DOESN'T NEED UNDO_ROW AND UNDO_EXT INITIALIZED
 mtr script could hit the assertion error !bpage->file_page_was_freed using this path.
 So, also fixed

rb://1337 approved by Marko Makela.
2012-11-26 15:59:35 +09:00
Yasufumi Kinoshita
c257dbe60c Bug #14676249 : ROW_VERS_IMPL_X_LOCKED_LOW() MIGHT HIT !BPAGE->FILE_PAGE_WAS_FREED ASSERTION
trx_undo_prev_version_build() should confirm existence of inherited (not-own) external pages.

Bug #14676084 : ROW_UNDO_MOD_UPD_DEL_SEC() DOESN'T NEED UNDO_ROW AND UNDO_EXT INITIALIZED
 mtr script could hit the assertion error !bpage->file_page_was_freed using this path.
 So, also fixed

rb://1337 approved by Marko Makela.
2012-11-26 15:57:26 +09:00
Sergei Golubchik
c499fa1ef3 XtraDB from Percona-Server-5.5.28-rel29.1 2012-11-22 11:43:55 +01:00
Sergei Golubchik
a48a91d90f 5.3->5.5 merge 2012-11-22 10:19:31 +01:00
Sergei Golubchik
13ba0dd286 MDEV-736 LP:1004615 - Unexpected warnings "Encountered illegal value '' when converting to DECIMAL" on a query with aggregate functions and GROUP BY
fix: don't call field->val_decimal() if the field->is_null()
because the buffer at field->ptr might not hold a valid decimal value

sql/item_sum.cc:
  do not call field->val_decimal() if the field->is_null()
storage/maria/ma_blockrec.c:
  cleanup
storage/maria/ma_rrnd.c:
  cleanup
strings/decimal.c:
  typo
2012-11-17 16:50:15 +01:00
Inaam Rana
eb5c1882a3 merge from 5.1 2012-11-16 09:06:27 -05:00
Inaam Rana
a46adb0f98 Bug#15859402 INNODB_BUFFER_POOL_READ_AHEAD_EVICTED IS INACCURATE
rb://1546
approved by: Sunny Bains and Marko Makela

Our dealing of buf_page_t::access_time flag is inaccurate.
* If LRU eviction has not started we don't set the access_time
* If LRU eviction is started we set it only if the block is not
'too old'.
* Not a correctness issue but we hold buf_pool::mutex when
setting the flag

This patch fixes this by:
* Setting flag unconditionally whenever the first page access happens
* Use buf_page_t mutex to protect write to the flag
2012-11-16 09:02:35 -05:00
Marko Mäkelä
94897a6394 Merge mysql-5.1 to mysql-5.5. 2012-11-15 22:11:03 +02:00
Marko Mäkelä
e882efe64a Bug#15872736 FAILING ASSERTION
Remove a bogus debug assertion.
2012-11-15 22:05:08 +02:00
Marko Mäkelä
20bbc6f7e7 Merge mysql-5.1 to mysql-5.5. 2012-11-15 20:38:04 +02:00
Marko Mäkelä
e5ad41716b Bug#15874001 CREATE INDEX ON A UTF8 CHAR COLUMN FAILS WITH ROW_FORMAT=REDUNDANT
CHAR(n) in ROW_FORMAT=REDUNDANT tables is always fixed-length
(n*mbmaxlen bytes), but in the temporary file it is variable-length
(n*mbminlen to n*mbmaxlen bytes) for variable-length character sets,
such as UTF-8.

The temporary file format used during index creation and online ALTER
TABLE is based on ROW_FORMAT=COMPACT. Thus, it should use the
variable-length encoding even if the base table is in
ROW_FORMAT=REDUNDNAT.

dtype_get_fixed_size_low(): Replace an assertion-like check with a
debug assertion.

rec_init_offsets_comp_ordinary(), rec_convert_dtuple_to_rec_comp():
Make this an inline function.  Replace 'ulint extra' with 'bool temp'.

rec_get_converted_size_comp_prefix_low(): Renamed from
rec_get_converted_size_comp_prefix(), and made inline. Add the
parameter 'bool temp'. If temp=true, do not add REC_N_NEW_EXTRA_BYTES.

rec_get_converted_size_comp_prefix(): Remove the comment about
dict_table_is_comp(). This function is only to be called for other
than ROW_FORMAT=REDUNDANT records.

rec_get_converted_size_temp(): New function for computing temporary
file record size. Omit REC_N_NEW_EXTRA_BYTES from the sizes.

rec_init_offsets_temp(), rec_convert_dtuple_to_temp(): New functions,
for operating on temporary file records.

rb:1559 approved by Jimmy Yang
2012-11-15 20:30:36 +02:00
Venkata Sidagam
118b756198 BUG#13556107: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST [3]
Problem description: Incorrect key file. Key file is corrupted,
while reading the keys from the file. The problem here is that 
keyseg->start (which should point to the beginning of a field) 
is pointing beyond total record length.

Fix: If keyseg->start is greater than total record length then 
return error.
2012-11-14 17:02:36 +05:30
Jimmy Yang
e42cd2db91 Fix Bug #14753402 - FAILING ASSERTION: LEN == IFIELD->FIXED_LEN
rb://1411 approved by Marko
2012-11-14 17:00:41 +08:00
Yasufumi Kinoshita
5a7553f36a Bug #14676111 WRONG PAGE_LEVEL WRITTEN FOR UPPER THAN FATHER PAGE AT BTR_LIFT_PAGE_UP()
btr_lift_page_up() writes wrong page number (different by -1) for upper than father page.
But in almost all of the cases, the father page should be root page, no upper
pages. It is very rare path.

In addition the leaf page should not be lifted unless the father page is root.
Because the branch pages should not become the leaf pages.

rb://1336 approved by Marko Makela.
2012-11-12 22:31:30 +09:00
Vasil Dimov
04195c30c1 This is a backport of "WL#5674 InnoDB: report all deadlocks (Bug#1784)"
from MySQL 5.6 into MySQL 5.5

Will close Bug#14515889 BACKPORT OF INNODB DEADLOCK LOGGING TO 5.5

The original implementation is in
vasil.dimov@oracle.com-20101213120811-k2ldtnao2t6zrxfn

Approved by:	Jimmy (rb:1535)
2012-11-12 14:24:43 +02:00
Yasufumi Kinoshita
51d01d7517 Bug #14676111 WRONG PAGE_LEVEL WRITTEN FOR UPPER THAN FATHER PAGE AT BTR_LIFT_PAGE_UP()
btr_lift_page_up() writes wrong page number (different by -1) for upper than father page.
But in almost all of the cases, the father page should be root page, no upper
pages. It is very rare path.

In addition the leaf page should not be lifted unless the father page is root.
Because the branch pages should not become the leaf pages.

rb://1336 approved by Marko Makela.
2012-11-12 22:33:40 +09:00
Venkata Sidagam
9749b60ee8 Bug#13556000: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST[2]
Problem description: Corrupt key file for the table. Size of the 
key is greater than the maximum specified size. This results in 
the overflow of the key buffer while reading the key from key 
file.

Fix: If size of key is greater than the maximum size it returns 
an error before writing it into the key buffer. Gives error as 
corrupt file but no stack overflow.
2012-11-09 19:19:11 +05:30
Annamalai Gurusami
2ad007dfd6 Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE
When a new primary key is added to an InnoDB table, then the following
steps are taken by InnoDB plugin:

.  let t1 be the original table.
.  a temporary table t1@00231 will be created by cloning t1.
.  all data will be copied from t1 to t1@00231.
.  rename t1 to t1@00232.
.  rename t1@00231 to t1.
.  drop t1@00232.

The rename and drop operations involve file operations.  But file operations
cannot be rolled back.  So in row_merge_rename_tables(), just after doing data
dictionary update and before doing any file operations, generate redo logs
for file operations and commit the transaction.  This will ensure that any
crash after this commit, the table is still recoverable by moving .ibd and
.frm files.  Manual recovery is required.

During recovery, the rename file operation redo logs are processed.
Previously this was being ignored.

rb://1460 approved by Marko Makela.
2012-11-09 19:04:01 +05:30
Annamalai Gurusami
2b68f44034 Merging from mysql-5.1 to mysql-5.5. 2012-11-09 18:56:20 +05:30
unknown
3f59033536 Merge MariaDB 5.1.66 -> 5.2 -> 5.3 2012-11-09 10:11:20 +02:00
unknown
c5cef4b166 Merge MariaDB 5.1.66 -> 5.2.12 2012-11-08 15:24:35 +02:00
Annamalai Gurusami
7ef879bb81 Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE
When a new primary key is added to an InnoDB table, then the following
steps are taken by InnoDB plugin:

.  let t1 be the original table.
.  a temporary table t1@00231 will be created by cloning t1.
.  all data will be copied from t1 to t1@00231.
.  rename t1 to t1@00232.
.  rename t1@00231 to t1.
.  drop t1@00232.

The rename and drop operations involve file operations.  But file operations
cannot be rolled back.  So in row_merge_rename_tables(), just after doing data
dictionary update and before doing any file operations, generate redo logs
for file operations and commit the transaction.  This will ensure that any
crash after this commit, the table is still recoverable by moving .ibd and
.frm files.  Manual recovery is required.

During recovery, the rename file operation redo logs are processed.
Previously this was being ignored.

rb://1460 approved by Marko Makela.
2012-11-08 18:09:13 +05:30
Venkata Sidagam
1d771aa425 Bug #11759445: CAN'T DELETE ROWS FROM MEMORY TABLE WITH HASH KEY.
Merging from 5.1 to 5.5
2012-11-07 09:03:33 +05:30
Venkata Sidagam
2226b1084c Bug #11759445: CAN'T DELETE ROWS FROM MEMORY TABLE WITH HASH KEY.
Brief description: After insert some rows to MEMORY table with HASH key some 
rows can't be deleted in one step.    

Problem Analysis/solution: info->current_ptr will have the information about the
current hash pointer from where we can traverse to the list to get all the       
remaining tuples.
      
In hp_delete_key we are updating info->current_ptr with the last_pos based on       
the flag parameter(which is the keydef and last index are same). As part of the       
fix we are making it to zero only when the code flow reaches to the end of the       
function hp_delete_key() it means that the next record which has to get deleted       
will be at the starting of the list so, that in the next call to       
read record(heap_rnext()) will take line number 100 path instead of 102 path, 
please see the below code in file hp_rnext.c, function heap_rnext().
 99       else if (!info->current_ptr)              /* Deleted or first call */
100         pos= hp_search(info, keyinfo, info->lastkey, 0);
101       else  
102         pos= hp_search(info, keyinfo, info->lastkey, 1);

with that change the hp_search() will update the info->current_ptr with the 
record which needs to be deleted.

storage/heap/hp_delete.c:
  In heap_delete_key() function we are making info->current_ptr to 0 if 
  flag is enabled.
2012-11-07 09:00:17 +05:30
unknown
7c23d6d0c6 Merge MySQL 5.1.66 -> MariaDB 5.1.65 2012-11-06 11:52:55 +02:00
Sergei Golubchik
73c8e44165 set username=hostname=NULL in the P_S for the aria background checkpoint thread 2012-11-05 12:40:17 +01:00
Sergei Golubchik
40e94a3734 merge with 5.5 2012-11-03 12:28:51 +01:00
unknown
a1108a0b6c Merge 5.2 -> 5.3 2012-11-01 21:36:31 +02:00
unknown
43293b7a51 Merge XtraDB from Percona-Server 5.1.66-rel14.1 into MariaDB 5.1. 2012-11-01 16:20:09 +01:00
unknown
8b5d345eea Merge 5.1 -> 5.2 2012-11-01 15:44:34 +02:00
Michael Widenius
fb90c36284 Fixed MDEV-612, LP:1010759 - Valgrind error ha_maria::check_if_incompatible_data on
mysql-test/r/partition.result:
  Added test case
mysql-test/t/partition.test:
  Added test case
sql/ha_partition.cc:
  Removed printing of not initialized variable
storage/maria/ha_maria.cc:
  Don't copy variables that are not initialized
2012-10-31 23:49:51 +02:00
Michael Widenius
b7ae1194e2 Fixed MDEV-647,LP:986261 - Aria unit tests fail at ma_test2
storage/maria/ma_test2.c:
  Problem was that rnd() generated bigger value than allocated array
2012-10-31 23:22:32 +02:00
unknown
d9a682adcf Do not build pbxt. 2012-10-31 23:04:53 +02:00
Venkata Sidagam
02501a0f97 BUG#13556441: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST [4]
Problem description:
mysql server crashes when we run repair table on currupted table.

Analysis:
The problem with this bug seem to be key_reflength out of bounds
(186 according to debugger). We read this value from meta-data
segment of .MYI file while doing mi_open().

If you look into _mi_kpointer() you can see that the upper limit
for key_reflength is 7.

Solution:
In mi_open() there is a line like:
  if (share->base.keystart > 65535 || share->base.rec_reflength > 8)
we should verify key_reflength here as well.
2012-10-31 18:32:53 +05:30
Vladislav Vaintroub
bc5232a65d MDEV-672 : storage/maria and storage/perfschema do not appear to honor WITH_UNIT_TESTS
Disable compiling unit tests if WITH_UNIT_TEST is FALSE.

Also, fix CMake code to allow compilation WITHOUT_ARIA_STORAGE_ENGINE
2012-10-30 23:05:55 +01:00
Vladislav Vaintroub
8d2c12a924 MDEV-3824 - xtradb file rename fails on Windows, if new name already exists.
Changed implementation os_file_rename() on Windows  such as it does not fail if destination file already exists. Now MoveFileEx() with MOVEFILE_REPLACE_EXISTING flag is used, instead of prior MoveFile().
This fixed implementation is better compatible with rename() on POSIX systems.
2012-10-30 19:13:39 +01:00
Anirudh Mangipudi
a18a3474bb BUG#11754894: MYISAMCHK ERROR HAS INCORRECT REFERENCE
TO 'MYISAM_SORT_BUFFER_SIZE'
Merging from 5.1 to 5.5
2012-10-30 19:00:12 +05:30
Anirudh Mangipudi
40b8b95142 BUG#11754894: MYISAMCHK ERROR HAS INCORRECT REFERENCE
TO 'MYISAM_SORT_BUFFER_SIZE'
Problem: 'myisam_sort_buffer_size' is a parameter used by 
mysqld program only whereas 'sort_buffer_size' is used by
mysqld and myisamchk programs. But the error message printed
when myisamchk program is run with insufficient buffer size 
is myisam_sort_buffer_size is too small which may mislead to the
server parameter myisam_sort_buffer_size.
SOLUTION: A parameter 'myisam_sort_buffer_size' is added as an
alias for 'sort_buffer_size' and the 'sort_buffer_size' parameter
is marked as deprecated. So myisamchk also has both the parameters
with the same role.
2012-10-30 18:49:15 +05:30
Anirudh Mangipudi
84d87d938a BUG#11754894: MYISAMCHK ERROR HAS INCORRECT REFERENCE
TO 'MYISAM_SORT_BUFFER_SIZE'
Problem: 'myisam_sort_buffer_size' is a parameter used by 
mysqld program only whereas 'sort_buffer_size' is used by
mysqld and myisamchk programs. But the error message printed
when myisamchk program is run with insufficient buffer size 
is myisam_sort_buffer_size is too small which may mislead to the
server parameter myisam_sort_buffer_size.
SOLUTION: A parameter 'myisam_sort_buffer_size' is added as an
alias for 'sort_buffer_size' and the 'sort_buffer_size' parameter
is marked as deprecated. So myisamchk also has both the parameters
with the same role.
2012-10-30 16:53:55 +05:30
Sergei Golubchik
cd5a6304b9 P_S test failures on 32-bit platforms:
always use intptr type when casting a pointer to an integer to avoid sign expansion.
  or, at least, cast identically in socket_summary_by_instance and socket_instances
2012-10-29 16:30:06 +01:00
Sergei Golubchik
2974093a50 workaround for gcc 4.3.2 bug on lenny-x86 at -O3
The following piece of code in trnman.c:

345   trn->min_read_from=  active_list_min.next->trid;
  ...
351   active_list_max.prev= trn->prev->next= trn;
352   trid_min_read_from= active_list_min.next->min_read_from;

on 345 gcc stores active_list_min.next in %ebx
(and trn->min_read_from=[%ebx]->trid)
and on 352 it does trid_min_read_from= [%ebx]->min_read_from;
BUT active_list_min.next was changed on the line 351.
gcc doesn't notice it and continues to use the cached value.
2012-10-29 11:12:29 +01:00
Sergei Golubchik
bba8b263c2 restore the lost (in mysql-5.6) bugfix for
Bug#13510739 63775: SERVER CRASH ON HANDLER READ NEXT AFTER DELETE RECORD.
2012-10-28 10:00:32 +01:00
Sergei Golubchik
d73e04588b fix innodb plugin versions 2012-10-27 17:24:25 +02:00
Marko Mäkelä
e5b11572bc Merge mysql-5.1 to mysql-5.5. 2012-10-22 22:13:26 +03:00
Marko Mäkelä
d13554b1f9 Backport from 5.6: Bug#14769820 ASSERT FLEN == LEN
IN ALTER TABLE ... ADD UNIQUE KEY

A bogus debug assertion failure occurred when reporting a duplicate
key on a column prefix of a CHAR column.

This is a regression from Bug#14729221 IN-PLACE ALTER TABLE REPORTS ''
INSTEAD OF REAL DUPLICATE VALUE FOR PREFIX KEYS. The assertion is only
present when UNIV_DEBUG is defined (which it is in debug builds
starting from MySQL 5.5). It is a case of overasserting.

Fix approved by Inaam Rana on IM.
2012-10-22 22:10:33 +03:00
Sergei Golubchik
7a1b9ef607 fix oqgraph compilation failures.
fix rpl_mdev382.result
2012-10-20 18:26:56 +02:00
Sergei Golubchik
e1f681c99b 10.0-base -> 10.0-monty 2012-10-19 20:38:59 +02:00
Sergei Golubchik
68baf07dcd 5.3 merge 2012-10-18 23:33:06 +02:00
Marko Mäkelä
f9389d584d Merge mysql-5.1 to mysql-5.5. 2012-10-18 17:14:57 +03:00
Marko Mäkelä
52ea152294 Bug#14758405: ALTER TABLE: ADDING SERIAL NULL DATATYPE: ASSERTION:
LEN <= SIZEOF(ULONGLONG)

This bug was caught in the WL#6255 ALTER TABLE...ADD COLUMN in MySQL
5.6, but there is a bug in all InnoDB versions that support
auto-increment columns.

row_search_autoinc_read_column(): When reading the maximum value of
the auto-increment column, and the column only contains NULL values,
return 0. This corresponds to the case when the table is empty in
row_search_max_autoinc().

rb:1415 approved by Sunny Bains
2012-10-18 17:03:06 +03:00
unknown
69a7b04add Merge mdev-452 with the latest 10.0-base. 2012-10-18 15:57:12 +03:00
unknown
bc4a456758 MDEV-452 Add full support for auto-initialized/updated timestamp and datetime
Generalized support for auto-updated and/or auto-initialized timestamp
and datetime columns. This patch is a reimplementation of MySQL's
"WL#5874: CURRENT_TIMESTAMP as DEFAULT for DATETIME columns". In order to
ease future merges, this implementation reused few function and variable
names from MySQL's patch, however the implementation is quite different.

TODO:
The only unresolved problem in this patch is the semantics of LOAD DATA for
TIMESTAMP and DATETIME columns in the cases when there are missing or NULL
columns. I couldn't fully comprehend the logic behind MySQL's behavior and
its relationship with their own documentation, so I left the results to be
more consistent with all other LOAD cases.

The problematic test cases can be seen by running the test file function_defaults,
and observing the test case differences. Those were left on purpose for discussion.
2012-10-17 15:43:56 +03:00
Yasufumi Kinoshita
bdc6895d35 Bug #13702112 : WAIT_FOR_READ IS STUCK IN THE 90S
rb://1334
approved by: Inaam Rana
2012-10-17 16:16:45 +09:00
Yasufumi Kinoshita
39e6eafc20 Bug #13702112 : WAIT_FOR_READ IS STUCK IN THE 90S
rb://1334
approved by: Inaam Rana
2012-10-17 15:28:31 +09:00
Marko Mäkelä
bb371b649d Merge mysql-5.1 to mysql-5.5. 2012-10-16 14:35:19 +03:00
Marko Mäkelä
aec624762b Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF
REAL DUPLICATE VALUE FOR PREFIX KEYS

innobase_rec_to_mysql(): Invoke dict_index_get_nth_col_or_prefix_pos()
instead of dict_index_get_nth_col_pos() to find the column.
2012-10-16 14:24:15 +03:00
Sergei Golubchik
ee9afef271 mysql-5.5.28 2012-10-16 13:04:42 +02:00
Sergei Golubchik
d9a8799205 XtraDB 1.1.8-29.0 2012-10-16 10:36:28 +02:00
Krunal Bauskar krunal.bauskar@oracle.com
ed6732dd16 bug#14704286
SECONDARY INDEX UPDATES MAKE CONSISTENT READS DO O(N^2) UNDO PAGE
LOOKUPS (honoring kill query while accessing sec_index)

If secondary index is being used for select query evaluation and this
query is operating with consistent read snapshot it might take good time for
secondary index to return back control to mysql as MVCC would kick in.

If user issues "kill query <id>" while query is actively accessing
secondary index it will not be honored as there is no hook to check
for this condition. Added hook for this check.

-----
Parallely secondary index taking too long to evaluate for consistent
read snapshot case is being examined for performance improvement. WL#6540.
2012-10-15 09:49:50 +05:30
Krunal Bauskar krunal.bauskar@oracle.com
9bfc910f2f bug#14704286
SECONDARY INDEX UPDATES MAKE CONSISTENT READS DO O(N^2) UNDO PAGE
LOOKUPS (honoring kill query while accessing sec_index)

If secondary index is being used for select query evaluation and this
query is operating with consistent read snapshot it might take good time for
secondary index to return back control to mysql as MVCC would kick in.

If user issues "kill query <id>" while query is actively accessing
secondary index it will not be honored as there is no hook to check
for this condition. Added hook for this check.

-----
Parallely secondary index taking too long to evaluate for consistent
read snapshot case is being examined for performance improvement. WL#6540.
2012-10-15 09:24:33 +05:30
Sergei Golubchik
c2da54ef26 simplify future xtradb merges (hopefully) 2012-10-12 18:15:38 +02:00
Vasil Dimov
1d16fc16dc Fix compilation error in debug mode:
os/os0file.c:1332: error: ISO C90 forbids mixed declarations and code
2012-10-10 22:22:10 +03:00
Vasil Dimov
61bd7d0ce9 Merge mysql-5.1 -> mysql-5.5 2012-10-09 16:41:13 +03:00
Vasil Dimov
4cefe863ae Port the test for Bug#14708715 from 5.1/innodb_plugin into 5.1/innodb
although the bug does not exist in 5.1/innodb.
2012-10-09 16:29:00 +03:00
Vasil Dimov
8baabf3090 Update the ChangeLog with the fix of Bug#14708715 2012-10-09 16:08:06 +03:00
Vasil Dimov
93398c307f Fix Bug#14708715 CREATE TABLE MEMORY LEAK ON DB_OUT_OF_FILE_SPACE
The problem is in the error handling in row_create_table_for_mysql().
In the 'disk full' case we may forget to call dict_mem_table_free() on
the table object.

Approved by:	Marko (rb:1377 and rb:1386)
2012-10-09 16:02:58 +03:00
Annamalai Gurusami
378a7d1ef5 Bug #14036214 MYSQLD CRASHES WHEN EXECUTING UPDATE IN TRX WITH
CONSISTENT SNAPSHOT OPTION

A transaction is started with a consistent snapshot.  After 
the transaction is started new indexes are added to the 
table.  Now when we issue an update statement, the optimizer
chooses an index.  When the index scan is being initialized
via ha_innobase::change_active_index(), InnoDB reports 
the error code HA_ERR_TABLE_DEF_CHANGED, with message 
stating that "insufficient history for index".

This error message is propagated up to the SQL layer.  But
the my_error() api is never called.  The statement level
diagnostics area is not updated with the correct error 
status (it remains in Diagnostics_area::DA_EMPTY).  

Hence the following check in the Protocol::end_statement()
fails.

 516   case Diagnostics_area::DA_EMPTY:
 517   default:
 518     DBUG_ASSERT(0);
 519     error= send_ok(thd->server_status, 0, 0, 0, NULL);
 520     break;

The fix is to backport the fix of bugs 14365043, 11761652 
and 11746399. 

14365043 PROTOCOL::END_STATEMENT(): ASSERTION `0' FAILED
11761652 HA_RND_INIT() RESULT CODE NOT CHECKED
11746399 RETURN VALUES OF HA_INDEX_INIT() AND INDEX_INIT() IGNORED

rb://1227 approved by guilhem and mattiasj.
2012-10-08 19:40:30 +05:30
Marko Mäkelä
52a4ef95e8 Merge mysql-5.1 to mysql-5.5.
Also, add debug check for trx_id sanity to row_upd_rec_sys_fields().
2012-10-08 16:18:54 +03:00
Marko Mäkelä
b06620868e Bug#14731482 UPDATE OR DELETE CORRUPTS A RECORD WITH A LONG PRIMARY KEY
We did not allocate enough bits for index->trx_id_offset, causing an
UPDATE or DELETE of a table with a PRIMARY KEY longer than 1024 bytes
to corrupt the PRIMARY KEY.

dict_index_t: Allocate enough bits.

dict_index_build_internal_clust(): Check for overflow of
index->trx_id_offset. Trip a debug assertion when overflow occurs.

rb:1380 approved by Jimmy Yang
2012-10-08 16:01:50 +03:00
Michael Widenius
00433b1b04 Automatic merge with 5.5 2012-10-05 00:00:21 +03:00
Michael Widenius
ea6a4eef3a Fixed issues found by buildbot & valgrind:
- Wrong thd uses in Item_subselect, could lead to crash
- Inititalize uninitialized variable in new autoincrement handling code


sql/handler.cc:
  More DBUG_PRINT
sql/item_subselect.cc:
  Wrong thd uses in Item_subselect, could lead to crash
storage/innobase/handler/ha_innodb.cc:
  Initialize variable needed by upper level. This only happens when auto-increment value wraps over.
storage/xtradb/handler/ha_innodb.cc:
  Initialize variable needed by upper level. This only happens when auto-increment value wraps over.
2012-10-04 23:52:11 +03:00
Michael Widenius
f3261f912e Automatic merge 2012-10-04 02:15:48 +03:00
Michael Widenius
3734a364f2 Automatic merge 2012-10-04 01:03:55 +03:00
Michael Widenius
572560f38c Changed SHOW_FUNC variabels that don't return SHOW_ARRAY to SHOW_SIMPLE_FUNC.
This allows us to avoid calculating variables (including those involving mutex) that doesn't match the given
wildcard in SHOW STATUS LIKE '...'
Removed all references to active_mi that could cause problems for multi-source replication.

Added START|STOP ALL SLAVES
Added SHOW ALL SLAVES STATUS


include/mysql/plugin.h:
  Added SHOW_SIMPLE_FUNC
include/mysql/plugin_audit.h.pp:
  Updated .pp file
include/mysql/plugin_auth.h.pp:
  Updated .pp file
include/mysql/plugin_ftparser.h.pp:
  Updated .pp file
mysql-test/suite/multi_source/info_logs.result:
  New columns in SHOW ALL SLAVES STATUS
mysql-test/suite/multi_source/info_logs.test:
  Test new syntax
mysql-test/suite/multi_source/simple.result:
  New columns in SHOW ALL SLAVES STATUS
mysql-test/suite/multi_source/simple.test:
  test new syntax
mysql-test/suite/multi_source/syntax.result:
  Updated result
mysql-test/suite/multi_source/syntax.test:
  Test new syntax
mysql-test/suite/rpl/r/rpl_skip_replication.result:
  Updated result
plugin/semisync/semisync_master_plugin.cc:
  SHOW_FUNC -> SHOW_SIMPLE_FUNC
sql/item_create.cc:
  Simplify code
sql/lex.h:
  Added SLAVES keyword
sql/log.cc:
  Constant -> define
sql/log_event.cc:
  Added comment
sql/mysqld.cc:
  SHOW_FUNC -> SHOW_SIMPLE_FUNC
  Made slave_retried_trans, slave_received_heartbeats and heartbeat_period multi-source safe
  Clear variable denied_connections and slave_retried_transactions on startup
sql/mysqld.h:
  Added slave_retried_transactions
sql/rpl_mi.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  Added start_all_slaves() and stop_all_slaves()
sql/rpl_mi.h:
  Added prototypes
sql/rpl_rli.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  added executed_entries
sql/rpl_rli.h:
  Added executed_entries
sql/share/errmsg-utf8.txt:
  More and better error messages
sql/slave.cc:
  Added more fields to SHOW ALL SLAVES STATUS
  Added slave_retried_transactions
  Changed constants -> defines
sql/sql_class.h:
  Added comment
sql/sql_insert.cc:
  active_mi.rli -> thd->rli_slave
sql/sql_lex.h:
  Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
sql/sql_load.cc:
  active_mi.rli -> thd->rli_slave
sql/sql_parse.cc:
  Added START|STOP ALL SLAVES
sql/sql_prepare.cc:
  Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
sql/sql_reload.cc:
  Made REFRESH RELAY LOG multi-source safe
sql/sql_repl.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  Don't send my_ok() from start_slave() or stop_slave() so that we can call it for all master connections
sql/sql_show.cc:
  Compare wild cards early for all variables
sql/sql_yacc.yy:
  Added START|STOP ALL SLAVES
  Added SHOW ALL SLAVES STATUS
sql/sys_vars.cc:
  Made replicate_events_marked_for_skip,slave_net_timeout and rpl_filter multi-source safe.
sql/sys_vars.h:
  Simplify Sys_var_rpl_filter
2012-10-03 01:44:54 +03:00
unknown
82eb2c6de0 fixed MDEV-568: Wrong result for a hash index look-up if the index is unique and the key is NULL
Check ability of index to be NULL as it made in MyISAM. UNIQUE with NULL could have several NULL entries so we have to continue even if ve have found a row.
2012-10-02 12:53:20 +03:00
Sergei Golubchik
416d0aebbf more fixes for test cases
mysql-test/suite/innodb/include/restart_and_reinit.inc:
  drop and recreate mysql.innodb* tables when deleting innodb table spaces
mysql-test/t/ssl_8k_key-master.opt:
  with loose- prefix ssl errors are ignored
sql-common/client.c:
  compiler warnings
sql/field.cc:
  use the new function
sql/item.cc:
  don't convert time to double or decimal via longlong,
  this loses sub-second part.
  Use dedicated functions.
sql/item.h:
  incorrect cast_to_int type for params
sql/item_strfunc.cc:
  use the new function
sql/lex.h:
  unused
sql/my_decimal.h:
  helper macro
sql/sql_plugin.cc:
  workaround for a compiler warning
sql/sql_yacc.yy:
  unused
sql/transaction.cc:
  fix the merge for SERVER_STATUS_IN_TRANS_READONLY protocol flag
storage/sphinx/CMakeLists.txt:
  compiler warnings
2012-10-01 13:15:29 +02:00
unknown
ce8484548b Fix of MDEV-565: Server crashes in ha_cassandra::write_row on inserting NULL into a dynamic column
Fixed incorrect initialization of variable which caused freeing memory by random address in case of error.
2012-09-29 16:01:24 +03:00
Annamalai Gurusami
b59a64e2f3 Bug #13249921 ASSERT !BPAGE->FILE_PAGE_WAS_FREED, USUALLY IN
TRANSACTION ROLLBACK

Description:  During the rollback operation, a blob page 
is removed earlier than desired.  Consider following scenario:

1. create table t1(a int primary key,b blob) engine=innodb;
2. insert into t1 values (1,repeat('b',9000));
3. begin;
4. update t1 set b=concat(b,'b');
5. update t1 set a=a+1;
6. insert into t1 values (1,repeat('b',9000));
7. rollback;

The update operation in line 5 produces 2 undo log record. The first
undo record (TRX_UNDO_DEL_MARK_REC) goes to trx->update_undo and the
second undo record (TRX_UNDO_INSERT_REC) goes to trx->insert_undo.
During rollback, they are executed out of order.

When the undo record TRX_UNDO_DEL_MARK_REC is applied/executed,
the blob ownership is also reset.  Because of this the blob page
is released earlier than desired.  This blob page must have been
freed only as part of applying/executing the undo record
TRX_UNDO_INSERT_REC.

This problem can be avoided by executing the undo records in
order.  This patch will make innodb to execute the undo records
in order.

rb://1125 approved by Marko.
2012-09-28 16:02:58 +05:30
Sergey Petrunya
aec2c55ac2 Fix compile: expect Thrift where it is at buildbot. 2012-09-28 14:02:59 +04:00
Sergey Petrunya
40d62823cd Fix compile warnings 2012-09-28 14:01:52 +04:00
unknown
3f8eaf7e87 Ending spaces removed. 2012-09-28 15:30:49 +03:00
unknown
245298f25d MDEV-506 Cassandra dynamic columns access 2012-09-28 15:27:16 +03:00
Sergei Golubchik
474fe6d9d9 fixes for test failures
and small collateral changes

mysql-test/lib/My/Test.pm:
  somehow with "print" we get truncated writes sometimes
mysql-test/suite/perfschema/r/digest_table_full.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/dml_handler.result:
  host table is not ported over yet
mysql-test/suite/perfschema/r/information_schema.result:
  host table is not ported over yet
mysql-test/suite/perfschema/r/nesting.result:
  this differs, because we don't rewrite general log queries, and multi-statement
  packets are logged as a one entry. this result file is identical to what mysql-5.6.5
  produces with the --log-raw option.
mysql-test/suite/perfschema/r/relaylog.result:
  MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB.
mysql-test/suite/perfschema/r/server_init.result:
  MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup.
mysql-test/suite/perfschema/r/stage_mdl_global.result:
  this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not
  do that, and this causes useless mutex locks and waits.
mysql-test/suite/perfschema/r/statement_digest.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_consumers.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_long_query.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result:
  will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
  will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
2012-09-27 20:09:46 +02:00
Sergei Golubchik
352d7cad1b merge 2012-09-27 15:02:17 +02:00
Sergey Petrunya
4db207d56d Cassandra SE: lazy connections
- Don't connect right away in ha_cassandra::open. If we do this, it becomes 
  impossible to do SHOW CREATE TABLE when the server is not present. 
- Note: CREATE TABLE still requires that connection is present, as it needs 
  to check whether the specified DDL can be used with Cassandra.  We could
  delay that check also, but then one would not be able to find out about 
  errors in table DDL until they do a SELECT.
2012-09-27 16:08:28 +04:00
Sergey Petrunya
2d88c4befb Cassandra SE
- Support UPDATE statements
- Follow what CQL does: don't show deleted rows (they show up as rows without any columns in reads)
2012-09-27 11:59:14 +04:00
Sergey Petrunya
c69a8fa616 - Update testcases
- Better error messages.
2012-09-26 19:02:12 +04:00
Sergey Petrunya
0362968be8 Cassandra SE:
- Add a test for ALTER TABLE
2012-09-26 14:57:45 +04:00
Sergey Petrunya
344c0ea423 Cassandra SE: Add capability to retry failed API calls
- Add capability to retry calls that have failed with UnavailableException or
  [Cassandra's] TimedOutException. 
- We don't retry for Thrift errors yet, although could easily do, now.
2012-09-26 14:13:03 +04:00
unknown
37155bf74a Fix some failures in 5.1 Buildbot:
- Fix some warnings in newer GCC (-Werror ...).
 - Fix wrong STACK_DIRECTION detected by configure due to compiler inlining.
2012-09-26 15:30:08 +02:00
unknown
7ca49db57c Merge from 5.1. 2012-09-26 18:29:49 +02:00
Sergey Petrunya
73dfd5782b Cassandra SE: more datatypes support
- Support mapping Cassandra's timestamp to INT64
- Support mapping Cassadnra's decimal to VARBINARY.
2012-09-25 16:20:19 +04:00
unknown
2f7d7c9f7f makes mi_test_all.sh & ma_test_all.sh working (MDEV-285) 2012-09-25 13:45:11 +03:00
Sergey Petrunya
366638718c Cassandra SE: varint datatype support:
- allow only VARBINARY(n), all other types can get meaningless data after conversions
- more comments
2012-09-24 20:58:26 +04:00
Sergey Petrunya
bce2e6683a Cassandra SE
- Add support for Cassandra's 'varint' datatype, mappable to VARBINARY.
2012-09-24 19:15:12 +04:00
Sergey Petrunya
c59faf95ae Cassandra SE: make consistency settings user-settable. 2012-09-22 23:30:29 +04:00
Michael Widenius
620d14f8c3 Automatic merge 2012-09-22 17:11:40 +03:00
Michael Widenius
3e83c4e8f9 Automatic merge 2012-09-22 15:30:24 +03:00
Sergey Petrunya
004e024775 Cassandra SE:
- Added @@cassandra_thrift_host global variable.
2012-09-20 14:22:36 +04:00
Marko Mäkelä
6bbe24e9a0 Bug#14636528 INNODB CHANGE BUFFERING IS NOT ENTIRELY CRASH-SAFE
Delete-mark change buffer records when resorting to a pessimistic
delete from the change buffer B-tree. Skip delete-marked records in
the change buffer merge and when estimating whether an operation can
be buffered. Without this fix, we could try to apply the same buffered
changes multiple times if the server was killed at the right moment.

In MySQL 5.5 and later: ibuf_get_volume_buffered_count_func(): Ignore
delete-marked (already processed) records.

ibuf_delete_rec(): Add a crash point before optimistic delete. If the
optimistic delete fails, flag the record processed before
mtr_commit().

ibuf_merge_or_delete_for_page(): Ignore delete-marked (already
processed) records.

Backport to 5.1: Rename btr_cur_del_unmark_for_ibuf() to
btr_cur_set_deleted_flag_for_ibuf() and add a parameter.

rb:1307 approved by Jimmy Yang
2012-09-19 22:35:38 +03:00
Michael Widenius
ae5bc05988 Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32767);
insert into t1 values(NULL);
ERROR 1062 (23000): Duplicate entry '32767' for key 'PRIMARY

Now on always gets error HA_ERR_AUTOINC_RANGE=167 "Out of range value for column", independent of
store engine, SQL Mode or number of inserted rows. This is an unique error that is easier to test for in replication.

Another bug fix is that we now get an error when trying to insert a too big auto-generated value, even in non-strict mode.
Before one get insted the max column value inserted.
This patch also fixes some issues with inserting negative numbers in an auto-increment column.
Fixed the ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
Added SQLSTATE errors for handler errors

Smaller bug fixes:
* Added warnings for duplicate key errors when using INSERT IGNORE
* Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
* Allow one to see how cmake is called by using --just-print --just-configure


BUILD/FINISH.sh:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
cmake/configure.pl:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
include/CMakeLists.txt:
  Added handler_state.h
include/handler_state.h:
  SQLSTATE for handler error messages.
  Required for HA_ERR_AUTOINC_ERANGE, but solves also some other cases.
mysql-test/extra/binlog_tests/binlog.test:
  Fixed old wrong behaviour
  Added more tests
mysql-test/extra/binlog_tests/binlog_insert_delayed.test:
  Reset binary log to only print what's necessary in show_binlog_events
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  Update to new error codes
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
  Ignore warnings as this depends on how the test is run
mysql-test/include/strict_autoinc.inc:
  On now gets an error on overflow
mysql-test/r/auto_increment.result:
  Update results after fixing error message
mysql-test/r/auto_increment_ranges_innodb.result:
  Test new behaviour
mysql-test/r/auto_increment_ranges_myisam.result:
  Test new behaviour
mysql-test/r/commit_1innodb.result:
  Added warnings for duplicate key error
mysql-test/r/create.result:
  Added warnings for duplicate key error
mysql-test/r/insert.result:
  Added warnings for duplicate key error
mysql-test/r/insert_select.result:
  Added warnings for duplicate key error
mysql-test/r/insert_update.result:
  Added warnings for duplicate key error
mysql-test/r/mix2_myisam.result:
  Added warnings for duplicate key error
mysql-test/r/myisam_mrr.result:
  Added warnings for duplicate key error
mysql-test/r/null_key.result:
  Added warnings for duplicate key error
mysql-test/r/replace.result:
  Update to new error codes
mysql-test/r/strict_autoinc_1myisam.result:
  Update to new error codes
mysql-test/r/strict_autoinc_2innodb.result:
  Update to new error codes
mysql-test/r/strict_autoinc_3heap.result:
  Update to new error codes
mysql-test/r/trigger.result:
  Added warnings for duplicate key error
mysql-test/r/xtradb_mrr.result:
  Added warnings for duplicate key error
mysql-test/suite/binlog/r/binlog_innodb_row.result:
  Updated result
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  Updated result
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Updated result
mysql-test/suite/innodb/r/innodb-autoinc.result:
  Update to new error codes
mysql-test/suite/innodb/r/innodb-lock.result:
  Updated results
mysql-test/suite/innodb/r/innodb.result:
  Updated results
mysql-test/suite/innodb/r/innodb_bug56947.result:
  Updated results
mysql-test/suite/innodb/r/innodb_mysql.result:
  Updated results
mysql-test/suite/innodb/t/innodb-autoinc.test:
  Update to new error codes
mysql-test/suite/maria/maria3.result:
  Updated result
mysql-test/suite/maria/mrr.result:
  Updated result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result:
  Updated result
mysql-test/suite/rpl/r/rpl_auto_increment.result:
  Update to new error codes
mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff:
  Updated results
mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
  Updated results
mysql-test/t/auto_increment.test:
  Update to new error codes
mysql-test/t/auto_increment_ranges.inc:
  Test new behaviour
mysql-test/t/auto_increment_ranges_innodb.test:
  Test new behaviour
mysql-test/t/auto_increment_ranges_myisam.test:
  Test new behaviour
mysql-test/t/replace.test:
  Update to new error codes
mysys/my_getopt.c:
  Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
sql/handler.cc:
  Ignore negative values for signed auto-increment columns
  Always give an error if we get an overflow for an auto-increment-column (instead of inserting the max value)
  Ensure that the row number is correct for the out-of-range-value error message.
  
  
  ******
  Fixed wrong printing of column namn for "Out of range value" errors
  Fixed that INSERT_ID is correctly replicated also for out-of-range autoincrement values
  Fixed that print_keydup_error() can also be used to generate warnings
  ******
  Return HA_ERR_AUTOINC_ERANGE (167) instead of ER_WARN_DATA_OUT_OF_RANGE for auto-increment overflow
sql/handler.h:
  Allow INSERT IGNORE to continue also after out-of-range inserts.
  Fixed that print_keydup_error() can also be used to generate warnings
sql/log_event.cc:
  Added DBUG_PRINT
  Fixed the ER_AUTOINC_READ_FAILED, ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
  This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
sql/sql_insert.cc:
  Add warnings for duplicate key errors when using INSERT IGNORE
sql/sql_state.c:
  Added handler errors
sql/sql_table.cc:
  Update call to print_keydup_error()
storage/innobase/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
storage/xtradb/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
2012-09-18 15:14:19 +03:00
Marko Mäkelä
300f3fb77f Bug#12701488 ASSERT PAGE_ZIP_VALIDATE, UNIV_ZIP_DEBUG
page_zip_validate(), page_zip_validate_low(): Add a parameter for the
B-tree index.

page_zip_validate_low(): If the page contents does not match, check
that the record link chains match. Furthermore, if dict_index_t is
passed, check that the records match. (This reduces coverage a bit: if
index=NULL, we will ignore differences in record contents, that is,
the page payload.)

rb:1264 approved by Inaam Rana
2012-09-17 14:21:00 +03:00
Sergey Petrunya
eb63b07ace Cassandra SE:
- added option thrift_port which allows to specify which port to connect to
- not adding username/password - it turns out, there are no authentication
  schemes in stock cassandra distribution.
2012-09-16 12:22:21 +04:00
Michael Widenius
cd9f773020 Automatic merge 2012-09-15 13:58:12 +03:00
Sergey Petrunya
c3de7c977a MDEV-530: Cassandra SE: Locking is incorrect
- Use more permissive locking.
2012-09-14 09:25:42 +04:00
Sergey Petrunya
c7b41e5d46 Cassandra SE
- Also provide handling for generic Thrift exceptions. These are not listed in the 'throws' clause
  of API definition but still can happen.
2012-09-14 09:03:25 +04:00
Sergey Petrunya
d6f2d692c1 Cassandra SE
- Catch all kinds of exceptions when calling Thrift code.
2012-09-14 08:44:34 +04:00
unknown
288eeb3a31 MDEV-232: Remove one fsync() from commit phase.
Introduce a new storage engine API method commit_checkpoint_request().
This is used to replace the fsync() at the end of every storage engine
commit with a single fsync() when a binlog is rotated.

Binlog rotation is now done during group commit instead of being
delayed until unlog(), removing some server stall and avoiding an
expensive lock/unlock of LOCK_log inside unlog().
2012-09-13 14:31:29 +02:00
Sergey Petrunya
16fec32ecc Cassandra SE: small optimization: StringCopyConverter::mariadb_to_cassandra doesn't need to make NULL-terminated strings. 2012-09-12 20:52:23 +04:00
Michael Widenius
1539f91267 Fixed Bug#1002564: Wrong result for a lookup query from a heap table
mysql-test/suite/heap/heap_hash.result:
  Added test case
mysql-test/suite/heap/heap_hash.test:
  Added test case
storage/heap/hp_hash.c:
  Limit key data length to max key length
2012-09-10 16:46:33 +03:00
Annamalai Gurusami
356c42d2c2 Merge from mysql-5.1 to mysql-5.5. 2012-09-28 16:42:31 +05:30
Inaam Rana
76e4d6acf0 Bug#14594600 ASSERT FROM DROP TABLE CONCURRENT WITH IBUF MERGES
rb://1293
approved by: Marko Makela

There is race when dropping a single table tablespace where a reader
thread can initiate a read request before the delete flag is set and
before it is finished the deleting thread can attempt to free the
fil_node.

This patch checks the status in fil_io() to make sure that the
tablespace is not being deleted. If it is being deleted then
an error is returned instead of attempting IO.
2012-09-20 08:44:33 -04:00
Marko Mäkelä
161a91d39f Merge mysql-5.1 to mysql-5.5. 2012-09-19 22:55:26 +03:00
Marko Mäkelä
d7089f6f3e Merge mysql-5.1 to mysql-5.5. 2012-09-17 14:32:07 +03:00
Sergey Petrunya
a3f33268ec Cassandra SE: add support for reading counter type values 2012-09-10 14:40:07 +04:00
Sergey Petrunya
4986de84ad Cassandra SE: added support for boolean type. 2012-09-07 15:32:43 +04:00
Sergei Golubchik
6af914f8b9 XtraDB from Percona-Server-5.5.27-rel28.1 2012-09-05 13:14:37 +02:00
Michael Widenius
1999be8d4e Automatic merge with 5.5 2012-09-01 00:54:54 +03:00
Michael Widenius
d13b5812b8 Updated TODO
Next step of merge

storage/myisam/mi_create.c:
  Merge from 5.6
2012-08-31 23:52:08 +03:00
Annamalai Gurusami
f3a6816fe5 Bug #13453036 ERROR CODE 1118: ROW SIZE TOO LARGE - EVEN
THOUGH IT IS NOT.

The following error message is misleading because it claims 
that the BLOB space is not counted.  

"ERROR 1118 (42000): Row size too large. The maximum row size for 
the used table type, not counting BLOBs, is 8126. You have to 
change some columns to TEXT or BLOBs"

When the ROW_FORMAT=compact or ROW_FORMAT=REDUNDANT is used,
the BLOB prefix is stored inline along with the row.  So 
the above error message is changed as follows depending on
the row format used:

For ROW_FORMAT=COMPRESSED or ROW_FORMAT=DYNAMIC, the error
message is as follows:

"ERROR 42000: Row size too large (> 8126). Changing some
columns to TEXT or BLOB may help. In current row format, 
BLOB prefix of 0 bytes is stored inline."

For ROW_FORMAT=COMPACT or ROW_FORMAT=REDUNDANT, the error
message is as follows:

"ERROR 42000: Row size too large (> 8126). Changing some
columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or 
ROW_FORMAT=COMPRESSED may help. In current row
format, BLOB prefix of 768 bytes is stored inline."

rb://1252 approved by Marko Makela
2012-08-31 15:42:00 +05:30
Sergey Petrunya
12ab6a4f3c MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system
- Make an attempt at fixing.
2012-08-31 11:03:59 +04:00
Sergey Petrunya
6cce520472 Cassandra SE
- add support for Cassandra's UUID datatype. We map it to CHAR(36).
2012-08-31 10:49:36 +04:00
Marko Mäkelä
d37f6298cf Bug#14554000 CRASH IN PAGE_REC_GET_NTH_CONST(NTH=0) DURING COMPRESSED
PAGE SPLIT

page_rec_get_nth_const(): Map nth==0 to the page infimum.

btr_compress(adjust=TRUE): Add a debug assertion for nth>0. The cursor
should never be positioned on the page infimum.

btr_index_page_validate(): Add test instrumentation for checking the
return values of page_rec_get_nth_const() during CHECK TABLE, and for
checking that the page directory slot 0 always contains only one
record, the predefined page infimum record.

page_cur_delete_rec(), page_delete_rec_list_end(): Add debug
assertions guarding against accessing the page slot 0.

page_copy_rec_list_start(): Clarify a comment about ret_pos==0.

rb:1248 approved by Jimmy Yang
2012-08-30 21:53:41 +03:00
Marko Mäkelä
961486e524 Bug#14547952: DEBUG BUILD FAILS ASSERTION IN RECORDS_IN_RANGE()
ha_innodb::records_in_range(): Remove a debug assertion
that prohibits an open range (full table).

The patch by Jorgen Loland only removed the assertion from the
built-in InnoDB, not from the InnoDB Plugin.
2012-08-30 21:49:24 +03:00
Sergey Petrunya
29e9406a82 Cassandra SE: fix batched insert to flush its buffers after insert operation. 2012-08-29 20:27:11 +04:00
Sergey Petrunya
6a827daf61 Fix for the previous cset: Field::store_TIME() accepts microseconds fraction, not millisecond. 2012-08-29 11:14:04 +04:00
Sergey Petrunya
fd53cbbff6 Cassandra SE: Timestamp data type support. 2012-08-29 11:05:46 +04:00
Sergey Petrunya
22e71e4cc1 Cassandra SE
- Add mapping for INT datatype
- Primary key column should now be named like CQL's primary key, 
  or 'rowkey' if CF has key_alias.
2012-08-29 10:05:21 +04:00
Sergey Petrunya
c34b24ff88 Cassandra storage engine: add @@rnd_batch_size variable. 2012-08-29 07:39:22 +04:00
Sergey Petrunya
c943dfd8b2 MDEV-494, part #1: phantom row for big full-scan selects
- Full table scan internally uses LIMIT n, and re-starts the scan from
  the last seen rowkey value.  rowkey ranges are inclusive, so we will
  see the same rowkey again. We should ignore it.
2012-08-28 20:22:45 +04:00
Jorgen Loland
816a8b5384 Bug#14547952: DEBUG BUILD FAILS ASSERTION IN RECORDS_IN_RANGE()
ha_innobase::records_in_range(): Remove a debug assertion
that prohibits an open range (full table).
This assertion catches unnecessary calls to this method, 
but such calls are not harming correctness.
2012-08-28 14:51:01 +02:00
Sergey Petrunya
869826d770 MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows
- Remove HTON_CAN_RECREATE flag, re-create won't delete rows in cassandra.
2012-08-28 12:53:33 +04:00
Sergey Petrunya
8eb16159e1 Cassandra storage engine: BKA support
- We use HA_MRR_NO_ASSOC ("optimizer_switch=join_cache_hashed") mode
- Not able to use BKA's buffers yet.
- There is a variable to control batch size
- There are status counters.
- Nedeed to make some fixes in BKA code (to be checked with Igor)
2012-08-27 08:44:58 +04:00
Sergey Petrunya
fdab0300c1 Cassandra storage engine: bulk INSERT support
- bulk inserts themselves
- control variable and counters.
2012-08-26 16:06:39 +04:00
Alexey Botchkov
d99b8004e6 SQL syntax extended with START TRANSACTION READ ONLY|READ WRITE
and SET TRANSACTION READ ONLT|READ WRITE
statements.


per-file comments:
  mysql-test/include/check-warnings.test
        READ ONLY transaction flag cleaned.
  mysql-test/r/commit.result
        result updated
  mysql-test/r/read_only.result
        result updated
  mysql-test/t/commit.test
        tests added.
  mysql-test/t/read_only.test
        tests added
  sql/lex.h
        ONLY symbol added.
  sql/sql_base.cc
        DBUG_RETURN added.
  sql/sql_parse.cc
        implementations added.
  sql/sql_yacc.yy
        SQL syntax extended.
  storage/perfschema/gen_pfs_lex_token
        changes forced by lex.h
  storage/perfschema/pfs_lex_token.h
        changes forced by lex.h
2012-08-25 20:57:17 +05:00
Sergei Golubchik
e988c4dde6 MDEV-336 oqgraph 5.5 crashes in buildbot
force -fno-strict-aliasing for oqgraph
2012-08-24 23:43:18 +02:00
Annamalai Gurusami
9d41d7c57b Bug #14500557 CRASH WHEN USING LONG INNODB INDEXES
The ha_innobase table handler contained two search key buffers
(srch_key_val1, srch_key_val2) of fixed size used to store the search
key.  The size of these buffers where fixed at
REC_VERSION_56_MAX_INDEX_COL_LEN + 2.  But this size is not sufficient
to hold the search key.  Hence the following assert in
row_sel_convert_mysql_key_to_innobase() failed.

2438                 /* Storing may use at most data_len bytes of buf */
2439 
2440                 if (UNIV_LIKELY(!is_null)) {
2441                         ut_a(buf + data_len <= original_buf + buf_len);
2442                         row_mysql_store_col_in_innobase_format(
2443                                 dfield, buf,
2444                                 FALSE, /* MySQL key value format col */
2445                                 key_ptr + data_offset, data_len,
2446                                 dict_table_is_comp(index->table));
2447                         buf += data_len;
2448                 }

The buffer size is now calculated with the formula
MAX_KEY_LENGTH + MAX_REF_PARTS*2.  This properly takes into account
the extra bytes needed to store the length for each column.  An index
can contain a maximum of MAX_REF_PARTS columns in it, and for each
column 2 bytes are needed to store length.  

rb://1238 approved by Marko and Vasil Dimov.
2012-09-04 14:33:56 +05:30
Annamalai Gurusami
3f0e739e3e Merge from mysql-5.1 to mysql-5.5. 2012-09-01 11:27:53 +05:30
Marko Mäkelä
22c0db6c3b Merge mysql-5.1 to mysql-5.5. 2012-08-30 22:01:23 +03:00
Aditya A
30aadd6b41 Bug#14145950 AUTO_INCREMENT ON DOUBLE WILL FAIL ON WINDOWS
Backport from mysql-5.6 the fix
(revision-id sunny.bains@oracle.com-20120315045831-20rgfa4cozxmz7kz)

  Bug#13839886 - CRASH IN INNOBASE_NEXT_AUTOINC
  
  The assertion introduce in the fix for Bug#13817703 
  is too strong, a negative  number can be greater 
  than the column max value, when the column value is
  a negative number.
  
  rb://978 Approved by Jimmy Yang.

rb:1236 approved by Marko Makela
2012-08-27 15:42:11 +05:30
Marc Alff
9bc328a41a Bug#13417440 : 63340: ARCHIVE FILE IO NOT INSTRUMENTED
WARNING

This patch is for mysql-5.5 only,
to be null-merged to mysql-5.6 and mysql-trunk.

This is a partial rollback of the file io instrumentation,
removing the instrumentation for mysql_file_stat in the archive engine.

See the bug comments for details.
2012-08-24 10:01:59 +02:00
Sergey Petrunya
38a3df4a2c - Enable mapping of CHAR(n)
- preparations for support of bulk INSERT.
2012-08-23 21:16:01 +04:00
Sergey Petrunya
38d4e02559 # MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY
- Fix typo in ha_cassandra::rnd_pos().
- in ::index_read_map(), do not assume that pk column is part of table->read_set.
2012-08-23 16:15:28 +04:00
Sergei Golubchik
4201939d57 remove mysql-5.1 assert that is already absent in mysql-5.5 2012-08-23 13:52:36 +02:00
Sergei Golubchik
f72a765997 5.2 merge.
two tests still fail:
  main.innodb_icp and main.range_vs_index_merge_innodb
  call records_in_range() with both range ends being open
  (which triggers an assert)
2012-08-22 16:45:25 +02:00
Sergei Golubchik
1fd8150a5b 5.1 merge
increase xtradb verson from 13.0 to 13.01
2012-08-22 16:13:54 +02:00
Sergei Golubchik
115a296756 merge with XtraDB as of Percona-Server-5.1.63-rel13.4 2012-08-22 16:10:31 +02:00
Sergei Golubchik
cefc30b166 merge with MySQL 5.1.65 2012-08-22 11:40:39 +02:00
Sergei Golubchik
0af0e7a70a merge XtraDB 1.1.8-27.0 from Percona-Server-5.5.25a-rel27.1 2012-08-22 09:56:20 +02:00
Sergey Petrunya
06ea60d221 Make ha_cassandra work with filesort(). 2012-08-21 18:38:27 +04:00
Marko Mäkelä
3f249921f8 Fix regression from Bug#12845774 OPTIMISTIC INSERT/UPDATE USES WRONG
HEURISTICS FOR COMPRESSED PAGE SIZE

The fix of Bug#12845774 was supposed to skip known-to-fail
btr_cur_optimistic_insert() calls. There was only one such call, in
btr_cur_pessimistic_update(). All other callers of
btr_cur_pessimistic_insert() would release and reacquire the B-tree
page latch before attempting the pessimistic insert. This would allow
other threads to restructure the B-tree, allowing (and requiring) the
insert to succeed as an optimistic (single-page) operation.

Failure to attempt an optimistic insert before a pessimistic one would
trigger an attempt to split an empty page.

rb:1234 approved by Sunny Bains
2012-08-21 10:47:17 +03:00
Michael Widenius
75e8ce6d73 Ensure we don't assert with debug binaries if SHOW INNODB STATUS returns with an error.
sql/handler.cc:
  SHOW INNODB STATUS sometimes returns 0 even if it has generated an error.
  This code is here to catch it until InnoDB some day is fixed.
storage/innobase/handler/ha_innodb.cc:
  Catch at least one of the possible errors from SHOW INNODB STATUS to provide a correct return code.
storage/xtradb/handler/ha_innodb.cc:
  Catch at least one of the possible errors from SHOW INNODB STATUS to provide a correct return code.
support-files/my-huge.cnf.sh:
  Fixed typo
2012-08-20 22:54:15 +03:00
Sergey Petrunya
81817412aa Read records in batches when doing full table scan. 2012-08-20 12:08:29 +04:00
Sergey Petrunya
38bc66fb1a position() and rnd_pos() implementations. 2012-08-19 14:54:58 +04:00
Sergey Petrunya
62c1c3f0c5 MDEV-431: Cassandra storage engine
- Partial support for DELETE ... WHERE.
2012-08-19 13:21:23 +04:00
Sergey Petrunya
d36259703b MDEV-431: Cassandra storage engine
- Descriptive error messages
- Unpack PK column on range scans
2012-08-19 12:50:53 +04:00
Sergey Petrunya
9cdf5eeec9 MDEV-431: Cassandra storage engine
- Support "DELETE FROM cassandra_table"
2012-08-18 21:29:31 +04:00
Sergey Petrunya
ab28174122 MDEV-431: Cassandra storage engine
- Got range reads to work (except for unpacking of the rowkey value)
2012-08-18 21:21:50 +04:00
Sergey Petrunya
0d840d4d23 MDEV-431: Cassandra storage engine
- Introduce type converters (so far rather trivial)
- switch INSERT to using batch_mutate()
2012-08-18 16:28:35 +04:00
Sergey Petrunya
c15914f761 Initial commit for Cassandra storage engine. 2012-08-17 21:13:20 +04:00
Marko Mäkelä
b252933551 Merge mysql-5.1 to mysql-5.5. 2012-08-21 10:59:11 +03:00
Michael Widenius
f1159b18d9 More fixes 2012-08-17 16:46:34 +03:00
Marko Mäkelä
bd6dbf21bb Merge mysql-5.1 to mysql-5.5. 2012-08-16 18:47:26 +03:00
Marko Mäkelä
e288e649c5 Bug#12595091 POSSIBLY INVALID ASSERTION IN BTR_CUR_PESSIMISTIC_UPDATE()
Facebook got a case where the page compresses really well so that
btr_cur_optimistic_update() returns DB_UNDERFLOW, but when a record
gets updated, the compression rate radically changes so that
btr_cur_insert_if_possible() can not insert in place despite
reorganizing/recompressing the page, leading to the assertion failing.

rb:1220 approved by Sunny Bains
2012-08-16 17:45:39 +03:00
Marko Mäkelä
6d7f6baa22 Bug#12845774 OPTIMISTIC INSERT/UPDATE USES WRONG HEURISTICS FOR
COMPRESSED PAGE SIZE

This was submitted as MySQL Bug 61456 and a patch provided by
Facebook. This patch follows the same idea, but instead of adding a
parameter to btr_cur_pessimistic_insert(), we simply remove the
btr_cur_optimistic_insert() call there and add it to the only caller
that needs it.

btr_cur_pessimistic_insert(): Do not try btr_cur_optimistic_insert().

btr_insert_on_non_leaf_level_func(): Invoke btr_cur_optimistic_insert()
before invoking btr_cur_pessimistic_insert().

btr_cur_pessimistic_update(): Clarify in a comment why it is not
necessary to invoke btr_cur_optimistic_insert().

btr_root_raise_and_insert(): Assert that the root page is not empty.
This could happen if a pessimistic insert (involving a split or merge)
is performed without first attempting an optimistic (intra-page) insert.

rb:1219 approved by Sunny Bains
2012-08-16 17:37:52 +03:00
Marko Mäkelä
95247de260 Bug#13523839 ASSERTION FAILURES ON COMPRESSED INNODB TABLES
btr_cur_optimistic_insert(): Remove a bogus assertion. The insert may
fail after reorganizing the page.

btr_cur_optimistic_update(): Do not attempt to reorganize compressed pages,
because compression may fail after reorganization.

page_copy_rec_list_start(): Use page_rec_get_nth() to restore to the
ret_pos, which may also be the page infimum.

rb:1221
2012-08-16 17:31:23 +03:00
Michael Widenius
dd8bd2e4c3 Fixed compiler warnings
sql/item_subselect.cc:
  Added purecov info
sql/sql_select.cc:
  Added cast
storage/innobase/handler/ha_innodb.cc:
  Added cast
storage/xtradb/btr/btr0btr.c:
  Added buf_block_get_frame_fast() to avoid compiler warning
storage/xtradb/handler/ha_innodb.cc:
  Added cast
storage/xtradb/include/buf0buf.h:
  Innodb has buf_block_get_frame(block) defined as (block)->frame.
  Didn't want to do a big change to break xtradb as it may use block_get_frame() differently, so I mad this quick hack to patch one compiler warning.
2012-08-15 09:34:18 +03:00
Michael Widenius
b886cac712 Fixed compiler errors
Updated test to also work on 32 bit

mysql-test/suite/heap/heap.test:
  Updated test to also work on 32 bit
2012-08-14 19:59:28 +03:00
Michael Widenius
60589aeee0 Next part of merge. See TODO for details 2012-08-14 17:23:34 +03:00
Michael Widenius
c0f04fa31c Automatic merge 2012-08-13 23:45:16 +03:00
Michael Widenius
cee888acb3 Fixed compiler warnings (A few of these was bugs)
client/mysqldump.c:
  Slave needs to be initialized with 0
dbug/dbug.c:
  Removed not existing function
plugin/semisync/semisync_master.cc:
  Fixed compiler warning
sql/opt_range.cc:
  thd needs to be set early as it's used in some error conditions.
sql/sql_table.cc:
  Changed to use uchar* to make array indexing portable
storage/innobase/handler/ha_innodb.cc:
  Removed not used variable
storage/maria/ma_delete.c:
  Fixed compiler warning
storage/maria/ma_write.c:
  Fixed compiler warning
2012-08-13 22:23:28 +03:00
Sergei Golubchik
c9b95de246 MDEV-336 oqgraph 5.5 crashes in buildbot
compile oqgraph with -fno-strict-aliasing
2012-08-11 10:31:10 +02:00
Sergei Golubchik
d11829654c merge with MySQL 5.5.27
manually checked every change, reverted incorrect or stupid changes.
2012-08-09 17:22:00 +02:00
Marko Mäkelä
05c6614d01 Merge mysql-5.1 to mysql-5.5. 2012-08-09 10:06:59 +03:00
Marko Mäkelä
bb84947969 Bug#14399148 INNODB TABLES UNDER LOAD PRODUCE DUPLICATE COPIES OF ROWS
IN QUERIES

This bug was caused by an incorrect fix of
Bug#13807811 BTR_PCUR_RESTORE_POSITION() CAN SKIP A RECORD

There was nothing wrong with btr_pcur_restore_position(), but with the
use of it in the table scan during index creation.

rb:1206 approved by Jimmy Yang
2012-08-09 09:55:29 +03:00
Michael Widenius
b39e6e3d09 Added support of thd->tx_read_only
Moved timestamp handling from all handler::write() methods in the storage engines to handler::ha_write

sql/handler.cc:
  Added PSI_CALL's
2012-08-07 07:25:15 +03:00
Michael Widenius
f2d7609ac0 Use less memory when growing HEAP tables. See MDEV-436
mysql-test/suite/heap/heap.result:
  Added test case for MDEV-436
mysql-test/suite/heap/heap.test:
  Added test case for MDEV-436
storage/heap/hp_block.c:
  Don't allocate a set of HP_PTRS when not needed. This saves us about 1024 bytes for most allocations.
storage/heap/hp_create.c:
  Made the initial allocation of block sizes depending on min_records and max_records.
2012-08-07 01:58:05 +03:00
Michael Widenius
a7123f5075 Fixed compiler warnings
sql/log.h:
  Fixed compiler warnings reported for gcc 2.7.1
storage/xtradb/handler/ha_innodb.cc:
  Remove not used variables
2012-08-06 16:33:11 +03:00
Michael Widenius
0a70eb33d1 Fixed test failures (part of merge) 2012-08-01 21:16:18 +03:00
Sergei Golubchik
6ed4a283fd MDEV-399 Combinations defined in the base suite cannot be skipped by overlay
When appliying parent combinations to the overlay,
filter them through the %skip_combinations using the overlayed filename
2012-08-01 19:57:36 +02:00
Vladislav Vaintroub
bd39599668 fix oqgraph on MSVC 2012-08-02 23:17:27 +02:00
Michael Widenius
1d0f70c2f8 Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6 2012-08-01 17:27:34 +03:00
Sergei Golubchik
6d4acc43e5 MDEV-336 oqgraph 5.5 crashes in buildbot
make CMakeLists.txt to detect if the installed boost can be compiled with the
installed compile and specified set of compiler options.

Background: even sufficiently new Boost cannot be compiled with the sufficiently old gcc
in the presence of -fno-rtti
2012-07-31 22:39:33 +02:00
Sergei Golubchik
0117a92fed MDEV-419 ensure that all HAVE_XXX constants can be set by cmake
add missing checks to configure.cmake
remove dead code and unused HAVE_xxx constants from the sources
2012-07-31 19:29:07 +02:00
Venkata Sidagam
fdaafddd80 Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE
Merged from mysql-5.1 to mysql-5.5
2012-07-26 15:29:19 +05:30
Venkata Sidagam
aef1982be0 Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE
Problem description:
Table 't' created with two colums having compound index on both the 
columns under innodb/myisam engine at remote machine. In the local 
machine same table is created undet the federated engine.
A select having where clause with along 'AND' operation gives wrong 
results on local machine.

Analysis: 
The given query at federated engine is wrongly transformed by 
federated::create_where_from_key() function and the same was sent to 
the remote machine. Hence the local machine is showing wrong results.

Given query "select c1 from t where c1 <= 2 and c2 = 1;"
Query transformed, after ha_federated::create_where_from_key() function is:
SELECT `c1`, `c2` FROM `t` WHERE  (`c1` IS NOT NULL ) AND 
( (`c1` >= 2)  AND  (`c2` <= 1) ) and the same sent to real_query().
In the above the '<=' and '=' conditions were transformed to '>=' and 
'<=' respectively.

ha_federated::create_where_from_key() function behaving as below:
The key_range is having both the start_key and end_key. The start_key 
is used to get "(`c1` IS NOT NULL )" part of the where clause, this 
transformation is correct. The end_key is used to get "( (`c1` >= 2) 
AND  (`c2` <= 1) )", which is wrong, here the given conditions('<=' and '=') 
are changed as wrong conditions('>=' and '<=').
The end_key is having {key = 0x39fa6d0 "", length = 10, keypart_map = 3, 
flag = HA_READ_AFTER_KEY}

The store_length is having value '5'. Based on store_length and length 
values the condition values is applied in HA_READ_AFTER_KEY switch case.
The switch case 'HA_READ_AFTER_KEY' is applicable to only the last part of 
the end_key and for previous parts it is going to 'HA_READ_KEY_OR_NEXT' case, 
here the '>=' is getting added as a condition instead of '<='.

Fix:
Updated the 'if' condition in 'HA_READ_AFTER_KEY' case to affect for all 
parts of the end_key. i.e 'i > 0' will used for end_key, Hence added it in 
the if condition.


mysql-test/suite/federated/federated.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_archive.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_13118.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_25714.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_35333.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_debug.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_innodb.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_server.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_transactions.test:
  modified the federated.inc file location
mysql-test/suite/federated/include/federated.inc:
  moved the file from federated suite to federated/include folder
mysql-test/suite/federated/include/federated_cleanup.inc:
  moved the file from federated suite to federated/include folder
mysql-test/suite/federated/include/have_federated_db.inc:
  moved the file from federated suite to federated/include folder
storage/federated/ha_federated.cc:
  updated the 'if condition' in ha_federated::create_where_from_key() 
  function.
2012-07-26 15:09:22 +05:30
Annamalai Gurusami
1383660024 Bug #13113026 INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRUFROM 5.6 BACKPORT
Backporting the WL#5716, "Information schema table for InnoDB 
buffer pool information". Backporting revisions 2876.244.113, 
2876.244.102 from mysql-trunk.

rb://1175 approved by Jimmy Yang.
2012-07-25 13:51:39 +05:30
Annamalai Gurusami
1c6f78e337 Bug #13113026 INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRUFROM 5.6 BACKPORT
Backporting the WL#5716, "Information schema table for InnoDB
buffer pool information". Backporting revisions 2876.244.113,
2876.244.102 from mysql-trunk.

rb://1177 approved by Jimmy Yang.
2012-07-25 10:48:16 +05:30
Ashish Agarwal
d15e2f7214 BUG#13555854: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST [1]
ISSUE: Incorrect key file. Key file is corrupted,
       Reading incorrect key information (keyseg)
       from index file. Key definition in .MYI
       and .FRM file differs. Starting pointer
       to read the keyseg information is changed
       to a value greater than the pack_reclength.
       Memcpy tries to read keyseg information from
       unallocated memory which causes the crash.

SOLUTION: One more check added to compare the
          the key definition in .MYI and .FRM
          file. If the definition differ, server
          produces an error.
2012-07-23 14:05:13 +05:30
Axel Schwenke
1b1b36ab3e merged with maria/5.5 2012-07-19 13:21:53 +02:00
Sergey Petrunya
79c4b4e440 Merge 5.3->5.5 2012-07-18 22:40:15 +04:00
Sergey Petrunya
7e6bec87c1 MDEV-398: Sergv related to spacial queries
- index_merge/intersection is unable to work on GIS indexes, because:
  1. index scans have no Rowid-Ordered-Retrieval property
  2. When one does an index-only read over a GIS index, they do not 
     get the index tuple, because index only contains bounding box of the geometry.
     This is why key_copy() call crashed.
This patch fixes #1, which makes the problem go away. Theoretically, it would 
be nice to check #2, too, but SE API semantics is not sufficiently precise to do it.
2012-07-18 15:03:05 +04:00
Elena Stepanova
72a5542f0e MDEV-11: Generic storage engine test suite 2012-07-16 06:17:56 +04:00
unknown
9f6a1c5842 fixed MySQL bug#53775:
Now partition engine adds underlying tables to the QC and ask underlying tables engine permittion to cache the query and return result of the query.

Incorrect QC cleanup in case of table registration failure fixe.

Unified interface for myisammrg & partitioned engnes for QC.
2012-07-13 22:17:32 +03:00
Jon Olav Hauglid
a47e778a61 Bug#12623923 Server can crash after failure to create
primary key with innodb tables

The bug was triggered if a single ALTER TABLE statement both
added and dropped indexes and ALTER TABLE failed during drop
(e.g. because the index was needed in a foreign key constraint).
In such cases, the server index information would get out of
sync with InnoDB - the added index would be present inside
InnoDB, but not in the server. This could then lead to InnoDB
error messages and/or server crashes.

The root cause is that new indexes are added before old indexes
are dropped. This means that if ALTER TABLE fails while dropping
indexes, index changes will be reverted in the server but not
inside InnoDB.

This patch fixes the problem by dropping any added indexes
if drop fails (for ALTER TABLE statements that both adds
and drops indexes). 

However, this won't work if we added a primary key as this
key might not be possible to drop inside InnoDB. Therefore,
we resort to the copy algorithm if a primary key is added
by an ALTER TABLE statement that also drops an index.

In 5.6 this bug is more properly fixed by the handler interface
changes done in the scope of WL#5534 "Online ALTER".
2012-07-10 16:13:02 +02:00
Michael Widenius
5a86a61219 Fixed wrong error codes from InnoDB/XtraDB that caused %M to give system dependent error messages (for unknown error code)
- InnoDB now returns handler specific HA_WRONG_CREATE_OPTION instead of MySQL specific ER_ILLEGAL_HA_CREATE_OPTION
- This changes the user level error message from "Unknown error" to "Wrong create options"


mysql-test/r/lowercase_table2.result:
  Updated result file
mysql-test/r/partition_innodb_plugin.result:
  Updated to new error message
mysql-test/r/partition_open_files_limit.result:
  Updated result file
mysql-test/r/row-checksum-old.result:
  Updated to new error message
mysql-test/r/row-checksum.result:
  Updated to new error message
mysql-test/r/symlink.result:
  Updated result file
mysql-test/suite/innodb/r/innodb-create-options.result:
  Updated to new error message
mysql-test/suite/innodb/r/innodb-zip.result:
  Updated to new error message
mysql-test/suite/innodb/r/innodb.result:
  Updated to new error message
storage/innobase/handler/ha_innodb.cc:
  Return HA_WRONG_CREATE_OPTION instead of ER_ILLEGAL_HA_CREATE_OPTION
  This gives more clear and OS indepedent error messages
storage/xtradb/handler/ha_innodb.cc:
  Return HA_WRONG_CREATE_OPTION instead of ER_ILLEGAL_HA_CREATE_OPTION
  This gives more clear and OS indepedent error messages
2012-07-06 19:10:18 +03:00
Ashish Agarwal
5f313125d4 BUG#13555854: CHECK AND REPAIR TABLE SHOULD BE MORE ROBUST [1]
ISSUE: Incorrect key file. Key file is corrupted,
       Reading incorrect key information (keyseg)
       from index file. Key definition in .MYI
       and .FRM file differs. Starting pointer
       to read the keyseg information is changed
       to a value greater than the pack_reclength.
       Memcpy tries to read keyseg information from
       unallocated memory which causes the crash.

SOLUTION: One more check added to compare the
          the key definition in .MYI and .FRM
          file. If the definition differ, server
          produces an error.
2012-07-02 15:20:23 +05:30
Jon Olav Hauglid
66ef5b0d48 Bug#14238406 NEW COMPILATION WARNINGS WITH GCC 4.7 (-WERROR=NARROWING)
Manual merge from mysql-5.1 to mysql-5.5
2012-06-29 13:36:01 +02:00
Jon Olav Hauglid
1ede2dd814 Bug#14238406 NEW COMPILATION WARNINGS WITH GCC 4.7 (-WERROR=NARROWING)
This patch fixes various compilation warnings of the type
"error: narrowing conversion of 'x' from 'datatype1' to
'datatype2'
2012-06-29 13:25:57 +02:00
Yasufumi Kinoshita
6058319dba Bug#14251529 : FIX FOR BUG 13704145 CREATES POSSIBLE RACE CONDITION
make buf_read_page_low() to treat DB_TABLESPACE_DELETED error correctly
rb#1129 approved by Inaam
2012-06-29 12:04:44 +09:00
Michael Widenius
69b817755a Automatic merge with 5.5
Fixed failing test case
2012-06-27 19:49:59 +03:00
Michael Widenius
aa67a198e8 automatic merge with 5.5 2012-06-27 17:22:23 +03:00
Michael Widenius
44d8fe9646 Don't abort InnoDB/XtraDB if one can't allocate resources for AIO
- Better error messages

This fixes that one again can run the test systems with many threads without having to increase fs.aio-max-nr.


mysql-test/include/mtr_check.sql:
  Ignore the INNODB_USE_NATIVE_AIO variable (may change during execution)
mysql-test/mysql-test-run.pl:
  Ignore warnings for failure to setup AIO
storage/innobase/os/os0file.c:
  Continue without AIO even if we can't allocate resources for AIO
storage/xtradb/os/os0file.c:
  Continue without AIO even if we can't allocate resources for AIO
storage/xtradb/srv/srv0start.c:
  Give an error message (instead of core dump) if AIO can't be initialized
2012-06-27 17:13:12 +03:00
Igor Babaev
2954ed1ec9 Merge 5.3->5.5. 2012-06-24 09:10:11 -07:00
Igor Babaev
20f3f4a273 Merge 5.2->5.3 2012-06-23 15:00:05 -07:00
Igor Babaev
d9c3a3e39e Fixed bug mdev-360.
The bug was the result of the incomplete fix for bug lp bug 1008293.
2012-06-23 12:19:07 -07:00
Sergei Golubchik
39005ea06f MDEV-349 5.5 xtradb innodb_prefix_index_liftedlimit crash with valgrind
This is XtraDB bug lp:1015109, introduced by innodb_split_buf_pool_mutex.patch

Comment the offending assertion, until the fixed XtraDB is available
2012-06-21 11:26:53 +02:00
Vladislav Vaintroub
49cadc9114 MDEV-361 - Fix handle leak in os_thread_create (Windows) 2012-06-21 00:49:24 +02:00
Michael Widenius
4f703fe70b Fixed MDEV-348: 5.5 valgrind warinings on maria tests 2012-06-20 14:37:37 +03:00
Sergei Golubchik
bf5df8ccbf merge 2012-06-16 09:03:07 +02:00
Sergei Golubchik
37f5632212 merged with XtraDB 1.1.8-26.0 2012-06-15 14:54:23 +02:00
Michael Widenius
acba7d2f9f Fixed MDEV-306 / LP:1007967 - Assertion `table->file->stats.records > 0 || error' failed join_read_const_table on concurrent SELECT and DROP/ADD INDEX
sql/sql_table.cc:
  Added comment
storage/maria/ma_close.c:
  Don't store history if it's visible to all.
  This fixed the MDEV-306 bug
storage/maria/ma_delete_table.c:
  Removed old comment
  Delete history state for deleted tables
storage/maria/ma_info.c:
  More DBUG_PRINT
storage/maria/ma_open.c:
  More DBUG_PRINT
2012-06-15 12:52:58 +03:00
Sergei Golubchik
13982b5a11 comments 2012-06-15 10:26:06 +02:00
Sergei Golubchik
0522307ed1 mysql-5.5 merge 2012-06-14 20:05:31 +02:00
Michael Widenius
efa48b2148 Merge with 5.5 2012-06-08 20:13:55 +03:00
Sergei Golubchik
d2ca6d2e7f apply mysql fix for bug#58421 to XtraDB 2012-06-08 14:50:50 +02:00
Narayanan Venkateswaran
164080e4a8 WL#6161 Integrating with InnoDB codebase in MySQL 5.5
Changes in the InnoDB codebase required to compile and
integrate the MEB codebase with MySQL 5.5.

@ storage/innobase/btr/btr0btr.c
  Excluded buffer pool usage from MEB build.
 
  buf_pool_from_bpage calls are in buf0buf.ic, and
  the buffer pool functions from that file are
  disabled in MEB.
@ storage/innobase/buf/buf0buf.c
  Disabling more buffer pool functions unused in MEB.
@ storage/innobase/dict/dict0dict.c
  Disabling dict_ind_free that is unused in MEB.
@ storage/innobase/dict/dict0mem.c
  The include

  #include "ha_prototypes.h"

  Was causing conflicts with definitions in my_global.h

  Linking C executable mysqlbackup
  libinnodb.a(dict0mem.c.o): In function `dict_mem_foreign_table_name_lookup_set':
  dict0mem.c:(.text+0x91c): undefined reference to `innobase_get_lower_case_table_names'
  libinnodb.a(dict0mem.c.o): In function `dict_mem_referenced_table_name_lookup_set':
  dict0mem.c:(.text+0x9fc): undefined reference to `innobase_get_lower_case_table_names'
  libinnodb.a(dict0mem.c.o): In function `dict_mem_foreign_table_name_lookup_set':
  dict0mem.c:(.text+0x96e): undefined reference to `innobase_casedn_str'
  libinnodb.a(dict0mem.c.o): In function `dict_mem_referenced_table_name_lookup_set':
  dict0mem.c:(.text+0xa4e): undefined reference to `innobase_casedn_str'
  collect2: ld returned 1 exit status
  make[2]: *** [mysqlbackup] Error 1

  innobase_get_lower_case_table_names
  innobase_casedn_str
  are functions that are part of ha_innodb.cc that is not part of the build
        
  dict_mem_foreign_table_name_lookup_set
  function is not there in the current codebase, meaning we do not use it in MEB.
@ storage/innobase/fil/fil0fil.c
  The srv_fast_shutdown variable is declared in
  srv0srv.c that is not compiled in the
  mysqlbackup codebase.

  This throws an undeclared error.

  From the Manual
  ---------------

  innodb_fast_shutdown
  --------------------

  The InnoDB shutdown mode. The default value is 1
  as of MySQL 3.23.50, which causes a “fast� shutdown
  (the normal type of shutdown). If the value is 0,
  InnoDB does a full purge and an insert buffer merge
  before a shutdown. These operations can take minutes,
  or even hours in extreme cases. If the value is 1,
  InnoDB skips these operations at shutdown.

  This ideally does not matter from mysqlbackup
  @ storage/innobase/ha/ha0ha.c
  In file included from /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/ha/ha0ha.c:34:0:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/btr0sea.h:286:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
  make[2]: *** [CMakeFiles/innodb.dir/home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/ha/ha0ha.c.o] Error 1
  make[1]: *** [CMakeFiles/innodb.dir/all] Error 2
  make: *** [all] Error 2

  # include "sync0rw.h" is excluded from hotbackup compilation in dict0dict.h

  This causes extern rw_lock_t*	btr_search_latch_temp; to throw a failure because
  the definition of rw_lock_t is not found.
@ storage/innobase/include/buf0buf.h
  Excluding buffer pool functions that are unused from the
  MEB codebase.
@ storage/innobase/include/buf0buf.ic
  replicated the exclusion of

  #include "buf0flu.h"
  #include "buf0lru.h"
  #include "buf0rea.h"

  by looking at the current codebase in <meb-trunk>/src/innodb
  @ storage/innobase/include/dict0dict.h
  dict_table_x_lock_indexes, dict_table_x_unlock_indexes, dict_table_is_corrupted,
  dict_index_is_corrupted, buf_block_buf_fix_inc_func are unused in MEB and was
  leading to compilation errors and hence excluded.
@ storage/innobase/include/dict0dict.ic
  dict_table_x_lock_indexes, dict_table_x_unlock_indexes, dict_table_is_corrupted,
  dict_index_is_corrupted, buf_block_buf_fix_inc_func are unused in MEB and was
  leading to compilation errors and hence excluded.
@ storage/innobase/include/log0log.h
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/log0log.h: At top level:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/log0log.h:767:2: error: expected specifier-qualifier-list before Ã¢â  ‚¬Ëœmutex_t’

  mutex_t definitions were excluded as seen from ambient code
  hence excluding definition for log_flush_order_mutex also.
@ storage/innobase/include/os0file.h
  Bug in InnoDB code, create_mode should have been create.
@ storage/innobase/include/srv0srv.h
  In file included from /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/buf/buf0buf.c:50:0:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/srv0srv.h: At top level:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/srv0srv.h:120:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘srv_use_native_aio’

  srv_use_native_aio - we do not use native aio of the OS anyway from MEB. MEB does not compile
  InnoDB with this option. Hence disabling it.
@ storage/innobase/include/trx0sys.h
  [ 56%] Building C object CMakeFiles/innodb.dir/home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c.o
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c: In function ‘trx_sys_read_file_format_id’:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c:1499:20: error: ‘TRX_SYS_FILE_FORMAT_TAG_MAGIC_N’   undeclared (first use in this function)
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c:1499:20: note: each undeclared identifier is reported only once for  each function it appears in
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c: At top level:
  /home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/include/buf0buf.h:607:1: warning: ‘buf_block_buf_fix_inc_func’ declared ‘static’ but never defined
  make[2]: *** [CMakeFiles/innodb.dir/home/narayanan/mysql-server/mysql-5.5-meb-rel3.8-innodb-integration-1/storage/innobase/trx/trx0sys.c.o] Error 1

  unused calls excluded to enable compilation
@ storage/innobase/mem/mem0dbg.c
    excluding #include "ha_prototypes.h" that lead to definitions in ha_innodb.cc
@ storage/innobase/os/os0file.c
    InnoDB not compiled with aio support from MEB anyway. Hence excluding this from
    the compilation.
@ storage/innobase/page/page0zip.c
  page0zip.c:(.text+0x4e9e): undefined reference to `buf_pool_from_block'
  collect2: ld returned 1 exit status

  buf_pool_from_block defined in buf0buf.ic, most of the file is excluded for compilation of MEB
@ storage/innobase/ut/ut0dbg.c
  excluding #include "ha_prototypes.h" since it leads to definitions in ha_innodb.cc
  innobase_basename(file) is defined in ha_innodb.cc. Hence excluding that also.
@ storage/innobase/ut/ut0ut.c
  cal_tm unused from MEB, was leading to earnings, hence disabling for MEB.
2012-06-07 19:14:26 +05:30
unknown
8efc63ba5d Merge 2012-06-06 16:19:48 +03:00
Michael Widenius
56ea8e9c05 Fixed build failures found by buildbot
- Added suppression of warnings
- Fixed some test cases


BUILD/FINISH.sh:
  Added AM_EXTRA_MAKEFLAGS
BUILD/SETUP.sh:
  Added option --extra-makeflags
client/mysqldump.c:
  Added suppression
mysql-test/r/mysql.result:
  Updated results
mysql-test/r/mysql_upgrade.result:
  Updated results
mysql-test/r/partition_innodb_plugin.result:
  Updated results
mysql-test/r/partition_open_files_limit.result:
  Updated results
mysql-test/r/symlink.result:
  Updated results
mysql-test/suite/innodb/r/innodb-create-options.result:
  Updated results
mysql-test/suite/innodb/t/innodb-create-options.test:
  Don't print error message (as it's varies on different system)
mysql-test/t/mysql.test:
  Don't print error message (as it's varies on different system)
mysql-test/t/mysql_upgrade.test:
  Fixed checking of error number
mysql-test/t/partition_innodb_plugin.test:
  Don't print error message (as it's varies on different system)
plugin/semisync/semisync_master.cc:
  Added suppression
sql/ha_partition.cc:
  Added suppression
sql/item_subselect.cc:
  Added suppression
sql/multi_range_read.cc:
  Added suppression
sql/sql_parse.cc:
  Added suppression
sql/sql_select.cc:
  Added suppression
storage/innobase/handler/ha_innodb.cc:
  Removed not used variable
storage/maria/ma_delete.c:
  Added suppression
storage/maria/ma_key_recover.c:
  Added suppression
storage/maria/ma_write.c:
  Added suppression
strings/ctype-ucs2.c:
  Added suppression
support-files/compiler_warnings.supp:
  Added suppressions
unittest/mysys/my_vsnprintf-t.c:
  Fixed test case with %M to also work on Solaris
2012-06-05 14:09:18 +03:00
Sergei Golubchik
265d5aaa2e MDEV-308 lp:1008516 - Failing assertion: templ->mysql_col_len == len
remove the offending assert.
take the test case from mysql Bug#58015
2012-06-04 23:22:03 +02:00
Sergei Golubchik
3e3606d21d merge with 5.3.
Take only test cases from MDEV-136 Non-blocking "set read_only"
2012-06-04 17:26:11 +02:00
Annamalai Gurusami
a28a2ca798 Bug #13933132: [ERROR] GOT ERROR -1 WHEN READING TABLE APPEARED
WHEN KILLING

Suppose there is a query waiting for a lock.  If the user kills
this query, then "Got error -1 when reading table" error message
must not be logged in the server log file.  Since this is a user
requested interruption, no spurious error message must be logged
in the server log.  This patch will remove the error message from
the log.

approved by joh and tatjana
2012-06-01 14:12:57 +05:30
Jon Olav Hauglid
1c0388a5be Bug#13982017: ALTER TABLE RENAME ENDS UP WITH ERROR 1050 (42S01)
Fixed by backport of:
    ------------------------------------------------------------
    revno: 3402.50.156
    committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
    branch nick: mysql-trunk-test
    timestamp: Wed 2012-02-08 14:10:23 +0100
    message:
      Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA
      
      This assert could be triggered if an InnoDB table was being moved
      to a different database using ALTER TABLE ... RENAME, while this
      database concurrently was being dropped by DROP DATABASE.
      
      The reason for the problem was that no metadata lock was taken
      on the target database by ALTER TABLE ... RENAME.
      DROP DATABASE was therefore not blocked and could remove
      the database while ALTER TABLE ... RENAME was executing. This
      could cause the assert in InnoDB to be triggered.
      
      This patch fixes the problem by taking a IX metadata lock on
      the target database before ALTER TABLE ... RENAME starts
      moving a table to a different database.
      
      Note that this problem did not occur with RENAME TABLE which
      already takes the correct metadata locks.
      
      Also note that this patch slightly changes the behavior of
      ALTER TABLE ... RENAME. Before, the statement would abort and
      return an error if a lock on the target table name could not
      be taken immediately. With this patch, ALTER TABLE ... RENAME
      will instead block and wait until the lock can be taken 
      (or until we get a lock timeout). This also means that it is
      possible to get ER_LOCK_DEADLOCK errors in this situation
      since we allow ALTER TABLE ... RENAME to wait and not just
      abort immediately.
2012-06-01 09:31:24 +02:00
Annamalai Gurusami
4acca3431f Merge from mysql-5.1 to mysql-5.5. 2012-06-01 11:49:07 +05:30
Marc Alff
cf48fcfba3 Bug 14116252 - CANNOT BUILD ARCHIVE ENGINE WHEN WITH_PERFSCHEMA_STORAGE_ENGINE=0
Fixed a build break with compiling without the performance schema,
instrumentation should be protected by HAVE_PSI_INTERFACE
2012-05-31 11:47:13 +02:00
Annamalai Gurusami
a2bc9b3669 Bug #13933132: [ERROR] GOT ERROR -1 WHEN READING TABLE APPEARED
WHEN KILLING

Suppose there is a query waiting for a lock.  If the user kills
this query, then "Got error -1 when reading table" error message
must not be logged in the server log file.  Since this is a user
requested interruption, no spurious error message must be logged
in the server log.  This patch will remove the error message from
the log.

approved by joh and tatjana
2012-05-30 10:05:04 +05:30
Alexey Botchkov
662c51bad1 MDEV-294 SELECT WHERE ST_CONTAINS doesn't return all the records where ST_CONTAINS() is 1.
Optimizator fails using index with ST_Within(g, constant_poly).

per-file comments:
  mysql-test/r/gis-rt-precise.result
        test result fixed.
  mysql-test/r/gis-rtree.result
        test result fixed.
  mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result
        test result fixed.
  mysql-test/suite/maria/r/maria-gis-rtree-trans.result
        test result fixed.
  mysql-test/suite/maria/r/maria-gis-rtree.result
        test result fixed.
  storage/maria/ma_rt_index.c
        Use MBR_INTERSECT mode when optimizing the select WITH ST_Within.
  storage/myisam/rt_index.c
        Use MBR_INTERSECT mode when optimizing the select WITH ST_Within.
2012-05-29 09:59:25 +05:00
Mayank Prasad
efe42792b3 Bug#13417440 : 63340: ARCHIVE FILE IO NOT INSTRUMENTED
Details:
 - Archive storage engine file access were not instrumented and thus
   were not shown in PS tables.
      
Fix:
 - Added instrumentation code by using PS Apis for I/O.
2012-05-24 23:00:32 +05:30
Inaam Rana
b91be27733 merge from 5.1 2012-05-24 12:44:27 -04:00
Inaam Rana
01748ce128 Bug #14100254 65389: MVCC IS BROKEN WITH IMPLICIT LOCK
rb://1088
approved by: Marko Makela

This bug was introduced in early stages of plugin. We were not
checking for an implicit lock on sec index rec for trx_id that is
stamped on current version of the clust_index in case where the
clust_index has a previous delete marked version.
2012-05-24 12:37:03 -04:00
Sergei Golubchik
ec586f529c Building RPMs with CPack
configure with cmake -DRPM=distro
2012-05-22 11:04:32 +02:00
Sergei Golubchik
7f6f53a8df 5.2 merge 2012-05-20 14:57:29 +02:00
Sergei Golubchik
280fcf0808 5.1 merge 2012-05-18 14:23:05 +02:00
Sergei Golubchik
0a8c9b98f6 merge with mysql-5.1.63 2012-05-17 12:12:33 +02:00
Annamalai Gurusami
ce9e6b5a9a Bug #13943231: ALTER TABLE AFTER DISCARD MAY CRASH THE SERVER
The following scenario crashes our mysql server:

1.  set global innodb_file_per_table=1;
2.  create table t1(c1 int) engine=innodb;
3.  alter table t1 discard tablespace;
4.  alter table t1 add unique index(c1);

Step 4 crashes the server.  This patch introduces a check on discarded
tablespace to avoid the crash.

rb://1041 approved by Marko Makela
2012-05-16 16:36:49 +05:30
Venkata Sidagam
6b05e434bf Bug #13955256: KEYCACHE CRASHES, CORRUPTIONS/HANGS WITH,
FULLTEXT INDEX AND CONCURRENT DML.

Problem Statement:
------------------
1) Create a table with FT index.
2) Enable concurrent inserts.
3) In multiple threads do below operations repeatedly
   a) truncate table
   b) insert into table ....
   c) select ... match .. against .. non-boolean/boolean mode

After some time we could observe two different assert core dumps

Analysis:
--------
1)assert core dump at key_read_cache():
Two select threads operating in-parallel on same key 
root block.
1st select thread block->status is set to BLOCK_ERROR 
because the my_pread() in read_block() is returning '0'. 
Truncate table made the index file size as 1024 and pread 
was asked to get the block of count bytes(1024 bytes) 
from offset of 1024 which it cannot read since its 
"end of file" and retuning '0' setting 
"my_errno= HA_ERR_FILE_TOO_SHORT" and the key_file_length, 
key_root[0] is same i.e. 1024. Since block status has BLOCK_ERROR 
the 1st select thread enter into the free_block() and will 
be under wait on conditional mutex by making status as 
BLOCK_REASSIGNED and goes for wait_on_readers(). Other select 
thread will also work on the same block and sees the status as 
BLOCK_ERROR and enters into free_block(), checks for BLOCK_REASSIGNED 
and asserting the server.

2)assert core dump at key_write_cache():
One select thread and One insert thread.
Select thread gets the unlocks the 'keycache->cache_lock', 
which allows other threads to continue and gets the pread() 
return value as'0'(please see the explanation above) and 
tries to get the lock on 'keycache->cache_lock' and waits 
there for the lock.
Insert thread requests for the block, block will be assigned 
from the hash list and makes the page_status as 
'PAGE_WAIT_TO_BE_READ' and goes for the read_block(), waits 
in the queue since there are some other threads performing 
reads on the same block.
Select thread which was waiting for the 'keycache->cache_lock' 
mutex in the read_block() will continue after getting the my_pread() 
value as '0' and sets the block status as BLOCK_ERROR and goes to 
the free_block() and go to the wait_for_readers().
Now the insert thread will awake and continues. and checks 
block->status as not BLOCK_READ and it asserts.  

Fix:
---
In the full text code, multiple readers of index file is not guarded. 
Hence added below below code in _ft2_search() and walk_and_match().

to lock the key_root I have used below code in _ft2_search()
 if (info->s->concurrent_insert)
    mysql_rwlock_rdlock(&share->key_root_lock[0]);

and to unlock 
 if (info->s->concurrent_insert)
   mysql_rwlock_unlock(&share->key_root_lock[0]);

storage/myisam/ft_boolean_search.c:
  Since its a recursion function, to avoid confusion in taking and 
  releasing the locks, renamed _ft2_search() to _ft2_search_internal() 
  function. And _ft2_search() will take the lock, call 
  _ft2_search_internal() and release the lock in case of concurrent 
  inserts.
storage/myisam/ft_nlq_search.c:
  Added read locks code in walk_and_match()
2012-05-16 16:14:27 +05:30
Marko Mäkelä
5917c58a5d Bug#14025221 FOREIGN KEY REFERENCES FREED MEMORY AFTER DROP INDEX
dict_table_replace_index_in_foreign_list(): Replace the dropped index
also in the foreign key constraints of child tables that are
referencing this table.

row_ins_check_foreign_constraint(): If the underlying index is
missing, refuse the operation.

rb:1051 approved by Jimmy Yang
2012-05-15 15:04:39 +03:00
Annamalai Gurusami
31a6bcbee4 Merge from mysql-5.1 to mysql-5.5. 2012-05-16 16:33:22 +05:30
Venkata Sidagam
7244e84e6d Merging the fix from mysql-5.1 to mysql-5.5 2012-05-16 16:06:07 +05:30
Annamalai Gurusami
7a6c449c62 Bug #13943231: ALTER TABLE AFTER DISCARD MAY CRASH THE SERVER
The following scenario crashes our mysql server:

1.  set global innodb_file_per_table=1;
2.  create table t1(c1 int) engine=innodb;
3.  alter table t1 discard tablespace;
4.  alter table t1 add unique index(c1);

Step 4 crashes the server.  This patch introduces a check on discarded
tablespace to avoid the crash.

rb://1041 approved by Marko Makela
2012-05-16 15:23:56 +05:30
Venkata Sidagam
0e9c1e9fc3 Bug #13955256: KEYCACHE CRASHES, CORRUPTIONS/HANGS WITH,
FULLTEXT INDEX AND CONCURRENT DML.

Problem Statement:
------------------
1) Create a table with FT index.
2) Enable concurrent inserts.
3) In multiple threads do below operations repeatedly
   a) truncate table
   b) insert into table ....
   c) select ... match .. against .. non-boolean/boolean mode

After some time we could observe two different assert core dumps

Analysis:
--------
1)assert core dump at key_read_cache():
Two select threads operating in-parallel on same key 
root block.
1st select thread block->status is set to BLOCK_ERROR 
because the my_pread() in read_block() is returning '0'. 
Truncate table made the index file size as 1024 and pread 
was asked to get the block of count bytes(1024 bytes) 
from offset of 1024 which it cannot read since its 
"end of file" and retuning '0' setting 
"my_errno= HA_ERR_FILE_TOO_SHORT" and the key_file_length, 
key_root[0] is same i.e. 1024. Since block status has BLOCK_ERROR 
the 1st select thread enter into the free_block() and will 
be under wait on conditional mutex by making status as 
BLOCK_REASSIGNED and goes for wait_on_readers(). Other select 
thread will also work on the same block and sees the status as 
BLOCK_ERROR and enters into free_block(), checks for BLOCK_REASSIGNED 
and asserting the server.

2)assert core dump at key_write_cache():
One select thread and One insert thread.
Select thread gets the unlocks the 'keycache->cache_lock', 
which allows other threads to continue and gets the pread() 
return value as'0'(please see the explanation above) and 
tries to get the lock on 'keycache->cache_lock' and waits 
there for the lock.
Insert thread requests for the block, block will be assigned 
from the hash list and makes the page_status as 
'PAGE_WAIT_TO_BE_READ' and goes for the read_block(), waits 
in the queue since there are some other threads performing 
reads on the same block.
Select thread which was waiting for the 'keycache->cache_lock' 
mutex in the read_block() will continue after getting the my_pread() 
value as '0' and sets the block status as BLOCK_ERROR and goes to 
the free_block() and go to the wait_for_readers().
Now the insert thread will awake and continues. and checks 
block->status as not BLOCK_READ and it asserts.  

Fix:
---
In the full text code, multiple readers of index file is not guarded. 
Hence added below below code in _ft2_search() and walk_and_match().

to lock the key_root I have used below code in _ft2_search()
 if (info->s->concurrent_insert)
    mysql_rwlock_rdlock(&share->key_root_lock[0]);

and to unlock 
 if (info->s->concurrent_insert)
   mysql_rwlock_unlock(&share->key_root_lock[0]);

storage/myisam/ft_boolean_search.c:
  Since its a recursion function, to avoid confusion in taking and 
  releasing the locks, renamed _ft2_search() to _ft2_search_internal() 
  function. And _ft2_search() will take the lock, call 
  _ft2_search_internal() and release the lock in case of concurrent 
  inserts.
storage/myisam/ft_nlq_search.c:
  Added read locks code in walk_and_match()
2012-05-16 13:55:22 +05:30
Marko Mäkelä
a6da754a31 Merge mysql-5.1 to mysql-5.5. 2012-05-15 15:11:34 +03:00
Sergei Golubchik
431e042b5d c 2012-05-21 15:30:25 +02:00
Michael Widenius
960f6600c8 Fixed compile warnings
Fixed some mtr test problems



dbug/tests.c:
  Fixed compiler warnings
mysql-test/r/handlersocket.result:
  Fixed that plugin_license is written
mysql-test/suite/innodb/t/innodb_bug60196.test:
  Force sorted results as it was sometimes different on windows
mysql-test/suite/rpl/t/rpl_heartbeat_basic.test:
  Prolong test as this failed on windows
mysql-test/t/handlersocket.test:
  Fixed that plugin_license is written
plugin/handler_socket/handlersocket/handlersocket.cpp:
  Use maria_declare_plugin
plugin/handler_socket/handlersocket/mysql_incl.hpp:
  Fixed compiler warning
plugin/handler_socket/libhsclient/auto_addrinfo.hpp:
  Fixed compiler warning
sql/handler.h:
  Fixed typo
sql/sql_plugin.cc:
  Fixed bug that caused plugin library name twice in error message
storage/maria/ma_checkpoint.c:
  Fixed compiler warning
storage/maria/ma_loghandler.c:
  Fixed compiler warning
unittest/mysys/base64-t.c:
  Fixed compiler warning
unittest/mysys/bitmap-t.c:
  Fixed compiler warning
unittest/mysys/my_malloc-t.c:
  Fixed compiler warning
2012-05-18 16:40:16 +03:00
Michael Widenius
d4d3ca204f Fixed lp:997460 Truncate table on partitioned Aria table fails with ER_ILLEGAL_HA
Fix is done by doing an autocommit in truncate table inside Aria

storage/maria/ha_maria.cc:
  Force a commit for TRUNCATE TABLE inside lock tables
  Check that we don't call TRUNCATE with concurrent inserts going on.
  Make ha_maria::implict_commit faster when we don't have Aria tables in the transaction.
  (Most of the patch is just re-indentation because I removed an if level)
2012-05-18 16:02:11 +03:00
Annamalai Gurusami
326b40c9c8 Merging from mysql-5.1 to mysql-5.5. 2012-05-10 10:33:16 +05:30
Annamalai Gurusami
391ea219c2 Bug #14007649 65111: INNODB SOMETIMES FAILS TO UPDATE ROWS INSERTED
BY A CONCURRENT TRANSACTIO

The member function QUICK_RANGE_SELECT::init_ror_merged_scan() performs
a table handler clone. Innodb does not provide a clone operation.  
The ha_innobase::clone() is not there. The handler::clone() does not 
take care of the ha_innobase->prebuilt->select_lock_type.  Because of 
this what happens is that for one index we do a locking read, and 
for the other index we were doing a non-locking (consistent) read. 
The patch introduces ha_innobase::clone() member function.  
It is implemented similar to ha_myisam::clone().  It calls the 
base class handler::clone() and then does any additional operation 
required.  I am setting the ha_innobase->prebuilt->select_lock_type 
correctly. 

rb://1060 approved by Marko
2012-05-10 10:18:31 +05:30
Sunanda Menon
074ce71e90 Merge from mysql-5.1.63-release 2012-05-08 07:19:14 +02:00
Joerg Bruehe
5be07ceadd Merge 5.5.24 back into main 5.5.
This is a weave merge, but without any conflicts.
In 14 source files, the copyright year needed to be updated to 2012.
2012-05-07 22:20:42 +02:00
Sergei Golubchik
44cf9ee5f7 5.3 merge 2012-05-04 07:16:38 +02:00
Yasufumi Kinoshita
96b62513f6 Bug#11758510 (#50723): INNODB CHECK TABLE FATAL SEMAPHORE WAIT TIMEOUT POSSIBLY TOO SHORT FOR BI
Fixed not to check timeout during the check table.
2012-04-27 19:40:12 +09:00
Yasufumi Kinoshita
08e7444e54 Bug#11758510 (#50723): INNODB CHECK TABLE FATAL SEMAPHORE WAIT TIMEOUT POSSIBLY TOO SHORT FOR BI
Fixed not to check timeout during the check table.
2012-04-27 19:38:13 +09:00
irana
02522904bc merge from 5.1 2012-04-26 08:21:25 -07:00
irana
1a2cf649dc InnoDB: Adjust error message when a dropped tablespace is accessed. 2012-04-26 08:17:14 -07:00
Inaam Rana
08ead005b1 Bug#13990648: 65061: LRU FLUSH RATE CALCULATION IS BASED ON INVALID VALUES
rb://1043
approved by: Sunny Bains

Two internal counters were incremented twice for a single
operations. The counters are:
srv_buf_pool_flushed
buf_lru_flush_page_count
2012-04-23 22:15:29 -04:00
Inaam Rana
2415d955c8 Bug#12677594 - 61575: INNODB: WARNING: IO_SETUP() FAILED WITH EAGAIN.
rb://1033
approved by: Marko Makela

Check return value from os_aio_init() and refuse to start if it fails.
2012-04-23 06:39:16 -04:00
Sergei Golubchik
5701d53190 MDEV-207 Install headers required to build external storage plugins
install all private headers in mysql/private/
2012-04-23 09:45:27 +02:00
Vladislav Vaintroub
2004bd1736 merge 2012-04-16 23:35:38 +02:00
Vladislav Vaintroub
806df88cc6 merge 2012-04-16 23:32:50 +02:00
Vladislav Vaintroub
85f7acf631 backport a change from 5.5 to remove thread sleeps from Innodb assertions on Windows.
This can result in bad deadlocks (e.g loader lock), seen in latest crash reports.
2012-04-16 23:31:02 +02:00
Vladislav Vaintroub
2451628923 Fixed some simple warnings on Windows. 2012-04-13 19:44:22 +02:00
Georgi Kodinov
a84ca72224 merge mysql-5.5->mysql-5.5-security 2012-04-12 14:04:12 +03:00
Vladislav Vaintroub
f544b21fcb Fix build on OSX
- Workaround linker bug that prevents linking aria test executables
   using -fno-common on OSX
- Skip system readline detection (OSX readline is incompatible one)
- Make Xcode generator work
2012-04-12 01:33:43 +02:00
unknown
99b18a036c Bug#11815557 60269: MYSQL SHOULD REJECT ATTEMPTS TO CREATE SYSTEM
TABLES IN INCORRECT ENGINE

PROBLEM:
  CREATE/ALTER TABLE currently can move system tables like
mysql.db, user, host etc, to engines other than MyISAM. This is not
completely supported as of now, by mysqld. When some of system tables
like plugin, servers, event, func, *_priv, time_zone* are moved
to innodb, mysqld restart crashes. Currently system tables
can be moved to BLACKHOLE also!!!.

ANALYSIS:
  The problem is that there is no check before creating or moving
a system table to some particular engine.

  System tables are suppose to be residing in MyISAM. We can think
of restricting system tables to exist only in MyISAM. But, there could
be future needs of these system tables to be part of other engines
by design. For eg, NDB cluster expects some tables to be on innodb
or ndb engine. This calls for a solution, by which system
tables can be supported by any desired engine, with minimal effort.

FIX:
  The solution provides a handlerton interface using which,
mysqld server can query particular storage engine handlerton for
system tables that it supports. This way each storage engine
layer can define their own system database and system tables.

  The check_engine() function uses the new handlerton function
ha_check_if_supported_system_table() to check if db.tablename
provided in the DDL is supported by the SE.

Note: This fix has modified a test in help.test, which was moving
mysql.help_* to innodb. The primary intention of the test was not
to move them between engines.
2012-04-11 15:53:17 +05:30
Georgi Kodinov
7fa28bcf56 merge mysql-5.5->mysql-5.5-security 2012-04-10 14:23:17 +03:00
Georgi Kodinov
df905524b2 merge mysql-5.1->mysql-5.1-security 2012-04-10 14:21:57 +03:00
Sergei Golubchik
16c5c53fc2 mysql 5.5.23 merge 2012-04-10 08:28:13 +02:00
Sergei Golubchik
f860b2aad4 merge 2012-04-07 15:58:46 +02:00
Alexey Botchkov
4632f33d33 merging. 2012-04-06 14:24:00 +05:00
Alexey Botchkov
ab5c6cd736 merging. 2012-04-06 13:51:42 +05:00
Alexey Botchkov
357c5f7464 MDEV-80 Memory engine table full at much less than max_heap_table_size with btree index.
RB-tree index in the MEMORY table fails if it grews over 4G.
        That happened because the old_allocated variable in hp_rb_write_key()
        had the uint type. Changed with the 'size_t' type to be same as the
        'rb_tree.allocated'.

per-file comments:
  storage/heap/hp_write.c
MDEV-80 Memory engine table full at much less than max_heap_table_size with btree index.
        uint->size_t for the 'old_allocated'.
2012-04-06 13:31:33 +05:00
Sergei Golubchik
a3073ecd96 merge 2012-04-05 23:07:18 +02:00
Sergei Golubchik
cbd52a42ee merge 2012-04-05 12:01:52 +02:00
Sergei Golubchik
dea3544b2d mysql-5.1.62 merge 2012-04-05 10:49:38 +02:00
Sergey Glukhov
ea1b0492a0 5.1-security -> 5.5-security merge 2012-04-04 14:19:00 +04:00