Commit graph

376 commits

Author SHA1 Message Date
Michael Widenius
1be5462d59 Merge with MariaDB 5.1 2011-05-03 19:10:10 +03:00
Michael Widenius
e415ba0fb2 Merge with MySQL 5.1.57/58
Moved some BSD string functions from Unireg
2011-05-02 20:58:45 +03:00
Michael Widenius
3358cdd504 Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
Michael Widenius
988d263e25 Merge with main 2011-02-22 20:28:01 +02:00
Michael Widenius
58bb0769bd Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria"
- Fixed wrong assert in Aria

Now need to merge with latest xtradb before pushing 

sql/ha_partition.cc:
  Ensure that m_ordered_rec_buffer is not freed before close.
sql/mysqld.cc:
  Changed to use opt_stack_trace instead of opt_pstack.
  Removed references to pstack
sql/partition_element.h:
  Ensure that connect_string is initialized
storage/maria/ma_key_recover.c:
  Fixed wrong assert
2011-02-20 18:51:43 +02:00
Michael Widenius
55c55d85bd Fixed bug in federatedx patch that caused partition tests to fail.
Fixed that connection string is returned for partitioned federated tables.

mysql-test/r/partition_federated.result:
  Fixed error message
mysql-test/suite/federated/federated_partition.result:
  Added test to show that connection string is returned in 'show create'.
sql/ha_partition.cc:
  Fixed a set of bugs introduced by the last federated patch:
  - We can't allocate m_ordered_rec_buffer in memroot as it has to survive call to clear_handler_file()
sql/partition_element.h:
  Ensure that connect_string is properly initialized.
  (This caused crashed in partition tests)
sql/sql_partition.cc:
  Print CONNECTION option for federated partitioned tables
2011-02-11 04:28:22 +02:00
Mattias Jonsson
62ab200343 Update of copyright headers for files I changed this year. 2011-01-27 23:47:24 +01:00
Mattias Jonsson
ec5e43da33 merge 2011-01-26 16:50:21 +01:00
Mattias Jonsson
c574a9c414 Bug#57924: crash when creating partitioned table with
multiple columns in the partition key

ndb crash if duplicate columns in the partitioning key.

Backport from mysql-5.1-telco-7.0, see bug#53354.

Changed from case sensitive field name comparision
to non case sensitive too.

mysql-test/r/partition_error.result:
  updated result
mysql-test/t/partition_error.test:
  Added test for the error in non-ndb partitioned table.
sql/sql_partition.cc:
  Added check for duplicated field names in the
  partitioning key.
2011-01-10 16:20:28 +01:00
Mattias Jonsson
8715503810 Bug#54483: valgrind errors when making warnings for
multiline inserts into partition
Bug#57071: EXTRACT(WEEK from date_col) cannot be
allowed as partitioning function

Renamed function according to reviewers comments.

sql/item.h:
  better name of processor function
sql/item_func.h:
  better name of processor function
sql/item_timefunc.h:
  better name of processor function
sql/sql_partition.cc:
  better name of processor function
  Updated comment.
2010-12-22 15:45:17 +01:00
Mattias Jonsson
1615419d72 Bug#54483: valgrind errors when making warnings for multiline inserts into partition
Bug#57071: EXTRACT(WEEK from date_col) cannot be allowed as partitioning function

There were functions allowed as partitioning functions
that implicit allowed cast. That could result in unacceptable
behaviour.

Solution was to check that the arguments of date and time functions
have allowed types (field and date/datetime/time depending on function).

mysql-test/r/partition.result:
  Updated result
mysql-test/r/partition_error.result:
  Updated result
mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc:
  disabled test with not allowed arguments.
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
  Updated result
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
  Updated result
mysql-test/t/partition.test:
  Fixed typo in bug number and removed non allowed function (bad argument)
mysql-test/t/partition_error.test:
  Added tests to verify correct type of argument.
sql/item.h:
  Renamed processor since it is no longer only for timezone
sql/item_func.h:
  Added help functions for checking date/time/datetime arguments.
sql/item_timefunc.h:
  Added processors for argument correctness
sql/sql_partition.cc:
  renamed the processor for checking arguments.
2010-12-22 10:50:36 +01:00
Michael Widenius
1e5061fe3b merge with 5.1 2010-11-30 23:11:03 +02:00
Michael Widenius
1a6373e8e2 Merge with MySQL 5.1.53
Open issues:
- A better fix for #57688; Igor is working on this
- Test failure in index_merge_innodb.test ; Igor promised to look at this
- Some Innodb tests fails (need to merge with latest xtradb) ; Kristian promised to look at this.
 - Failing tests: innodb_plugin.innodb_bug56143 innodb_plugin.innodb_bug56632 innodb_plugin.innodb_bug56680 innodb_plugin.innodb_bug57255 
- Werror is disabled;  Should be enabled after merge with xtradb.
2010-11-25 00:57:34 +02:00
Ramil Kalimullin
e4d2fd35a7 Auto-merge from mysql-5.1-bugteam. 2010-11-18 13:40:57 +03:00
Mattias Jonsson
027d647521 merge 2010-11-15 16:32:21 +01:00
Davi Arnaut
cd1c6e220d Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
Bug#57994: Compiler flag change build error : my_redel.c
Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc

Fix assorted compiler generated warnings.

cmd-line-utils/readline/bind.c:
  Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
  
  Initialize variable to work around a false positive warning.
include/m_string.h:
  Bug#57994: Compiler flag change build error : my_redel.c
  
  The expansion of stpcpy (in glibc) causes warnings if the
  return value of strmov is not being used. Since stpcpy is
  a GNU extension and the expansion ends up using a built-in
  provided by GCC, use the compiler provided built-in directly
  when possible.
include/my_compiler.h:
  Define a dummy MY_GNUC_PREREQ when not compiling with GCC.
libmysql/libmysql.c:
  Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
  
  Variable might not be used in some cases. So, tag it as unused.
mysys/mf_keycache.c:
  Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
  
  Use UNINIT_VAR to work around a false positive warning.
mysys/my_getncpus.c:
  Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
  
  Declare variable in the same block where it is used.
regex/regexec.c:
  Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
  
  Work around a compiler bug which causes the cast to not be enforced.
sql/debug_sync.cc:
  Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc
  
  Use UNINIT_VAR to work around a false positive warning.
sql/handler.cc:
  Use UNINIT_VAR to work around a false positive warning.
sql/slave.cc:
  Use UNINIT_VAR to work around a false positive warning.
sql/sql_partition.cc:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisam/ft_nlq_search.c:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisam/mi_create.c:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisammrg/myrg_open.c:
  Use UNINIT_VAR to work around a false positive warning.
tests/mysql_client_test.c:
  Change function to take a pointer to const, no need for a cast.
2010-11-10 19:14:47 -02:00
Davi Arnaut
3e9c52250a Bug#45288: pb2 returns a lot of compilation warnings
Fix assorted warnings that are generated in optimized builds.
Most of it is silencing variables that are set but unused.

This patch also introduces the MY_ASSERT_UNREACHABLE macro
which helps the compiler to deduce that a certain piece of
code is unreachable.

include/my_compiler.h:
  Use GCC's __builtin_unreachable if available. It allows
  GCC to deduce the unreachability of certain code paths,
  thus avoiding warnings that, for example, accused that a
  variable could be used without being initialized (due to
  unreachable code paths).
2010-10-20 16:21:40 -02:00
Mattias Jonsson
dd1d7ff161 Bug#55091: Server crashes on ADD PARTITION after a failed attempt
In case of failure in ALTER ... PARTITION under LOCK TABLE
the server could crash, due to it had modified the locked
table object, which was not reverted in case of failure,
resulting in a bad table definition used after the failed
command.

Solved by always closing the LOCKED TABLE, even in case
of error.

Note: this is a 5.1-only fix, bug#56172 fixed it in 5.5+

mysql-test/r/partition_innodb_plugin.result:
  updated result
mysql-test/t/disabled.def:
  Only disabled valgrind instead.
mysql-test/t/partition_innodb_plugin.test:
  Added test
sql/sql_partition.cc:
  close_thread_tables do not close LOCKED TABLEs
  and destroys the table object (including part_info),
  so to avoid it to be reused, always close the table
  regardless of any previous failure.
2010-10-05 14:57:51 +02:00
Sergei Golubchik
a3d80d952d merge with 5.1 2010-09-11 20:43:48 +02:00
Michael Widenius
ad6d95d3cb Merge with MySQL 5.1.50
- Changed to still use bcmp() in certain cases becasue
  - Faster for short unaligneed strings than memcmp()
  - Bettern when using valgrind
- Changed to use my_sprintf() instead of sprintf() to get higher portability for old systems
- Changed code to use MariaDB version of select->skip_record()
- Removed -%::SCCS/s.% from Makefile.am:s to remove automake warnings
2010-08-27 17:12:44 +03:00
Michael Widenius
165eb1186c Added extra argument to longlong2str() to make it have same prototype is int2str()
Changed to use longlong10_to_str() instead of longlong2str() when base is 10 or -10 as former is much faster than later
Changed my_vsnprintf() to use longlong2str instead of int2str() to get rid of warnings and to get support for long pointers even when long is 32 bit.

client/mysqltest.cc:
  longlong2str() -> longlong10_to_str()
include/m_string.h:
  Added extra argument to longlong2str() to make it have same prototype is int2str()
mysys/charset.c:
  Fixed compiler warning
mysys/mf_soundex.c:
  Fixed compiler warning
mysys/my_getopt.c:
  longlong2str() -> longlong10_to_str()
sql/create_options.cc:
  Fixed compiler warning
sql/item_strfunc.cc:
  Added extra argument to longlong2str
sql/opt_range.cc:
  longlong2str() -> longlong10_to_str()
sql/partition_info.cc:
  longlong2str() -> longlong10_to_str()
sql/slave.cc:
  longlong2str() -> longlong10_to_str()
sql/sql_bitmap.h:
  Added extra argument to longlong2str
sql/sql_partition.cc:
  Added extra argument to longlong2str
sql/sql_select.cc:
  longlong2str() -> longlong10_to_str()
sql/sql_show.cc:
  Added extra argument to longlong2str
storage/innodb_plugin/handler/ha_innodb.cc:
  Update to new parameters for longlong2str()
storage/maria/ma_dbug.c:
  longlong2str() -> longlong10_to_str()
storage/maria/maria_chk.c:
  Added extra argument to longlong2str
storage/myisam/mi_dbug.c:
  longlong2str() -> longlong10_to_str()
storage/myisam/myisamchk.c:
  Added extra argument to longlong2str
storage/xtradb/handler/ha_innodb.cc:
  Update to new parameters for longlong2str()
strings/longlong2str.c:
  Added extra argument to longlong2str() to make it have same prototype is int2str()
strings/my_vsnprintf.c:
  Changed my_vsnprintf() to use longlong2str instead of int2str() to get rid of warnings and to get support for long pointers even when long is 32 bit.
  Added cast to get rid of compiler warnings
2010-08-07 15:27:23 +03:00
Michael Widenius
d042146e5b Merge with MariaDB 5.1.49
Removed references to HA_END_SPACE_KEY (which has been 0 for a long time)
2010-08-05 22:56:11 +03:00
Michael Widenius
e0a6b02c5d Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
2010-08-02 12:01:24 +03:00
unknown
2124538d9c BUG#49124 Security issue with /*!-versioned */ SQL statements on Slave
/*![:version:] Query Code */, where [:version:] is a sequence of 5 
digits representing the mysql server version(e.g /*!50200 ... */),
is a special comment that the query in it can be executed on those 
servers whose versions are larger than the version appearing in the 
comment. It leads to a security issue when slave's version is larger 
than master's. A malicious user can improve his privileges on slaves. 
Because slave SQL thread is running with SUPER privileges, so it can
execute queries that he/she does not have privileges on master.

This bug is fixed with the logic below: 
- To replace '!' with ' ' in the magic comments which are not applied on
  master. So they become common comments and will not be applied on slave.

- Example:
  'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
  will be binlogged as
  'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/

mysql-test/suite/rpl/t/rpl_conditional_comments.test:
  Test the patch for this bug.
sql/mysql_priv.h:
  Rename inBuf as rawBuf and remove the const limitation.
sql/sql_lex.cc:
  To replace '!' with ' ' in the magic comments which are not applied on
  master.
sql/sql_lex.h:
  Remove the const limitation on parameter buff, as it can be modified in the function since
  this patch.
  Add member function yyUnput for Lex_input_stream. It set a character back the query buff.
sql/sql_parse.cc:
  Rename inBuf as rawBuf and remove the const limitation.
sql/sql_partition.cc:
  Remove the const limitation on parameter part_buff, as it can be modified in the function since
  this patch.
sql/sql_partition.h:
  Remove the const limitation on parameter part_buff, as it can be modified in the function since
  this patch.
sql/table.h:
  Remove the const limitation on variable partition_info, as it can be modified since
  this patch.
2010-07-29 11:00:57 +08:00
Sergei Golubchik
ffc8f62b08 merge 5.1->5.2 2010-06-01 21:52:20 +02:00
Alexey Kopytov
c2ebb0ac88 Bug #42064: low memory crash when importing hex strings, in
Item_hex_string::Item_hex_string

The status of memory allocation in the Lex_input_stream (called
from the Parser_state constructor) was not checked which led to
a parser crash in case of the out-of-memory error.

The solution is to introduce new init() member function in
Parser_state and Lex_input_stream so that status of memory
allocation can be returned to the caller.

mysql-test/r/error_simulation.result:
  Added a test case for bug #42064.
mysql-test/t/error_simulation.test:
  Added a test case for bug #42064.
mysys/my_alloc.c:
  Added error injection code for the regression test.
mysys/my_malloc.c:
  Added error injection code for the regression test.
mysys/safemalloc.c:
  Added error injection code for the regression test.
sql/event_data_objects.cc:
  Use the new init() member function of Parser_state and check
  its return value to handle memory allocation failures.
sql/mysqld.cc:
  Added error injection code for the regression test.
sql/sp.cc:
  Use the new init() member function of Parser_state and check
  its return value to handle memory allocation failures.
sql/sql_lex.cc:
  Moved memory allocation from constructor to the separate init()
  member function.
  Added error injection code for the regression test.
sql/sql_lex.h:
  Moved memory allocation from constructor to the separate init()
  member function.
sql/sql_parse.cc:
  Use the new init() member function of Parser_state and check
  its return value to handle memory allocation failures.
sql/sql_partition.cc:
  Use the new init() member function of Parser_state and check
  its return value to handle memory allocation failures.
sql/sql_prepare.cc:
  Use the new init() member function of Parser_state and check
  its return value to handle memory allocation failures.
sql/sql_trigger.cc:
  Use the new init() member function of Parser_state and check
  its return value to handle memory allocation failures.
sql/sql_view.cc:
  Use the new init() member function of Parser_state and check
  its return value to handle memory allocation failures..
sql/thr_malloc.cc:
  Added error injection code for the regression test.
2010-05-21 15:23:48 +04:00
unknown
b1e00b6be8 Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
2010-04-28 14:52:24 +02:00
Mattias Jonsson
5196beed02 Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
concurrent I_S query

There were two problem:
1) MYSQL_LOCK_IGNORE_FLUSH also ignored name locks
2) there was a race between abort_and_upgrade_locks and
   alter_close_tables
   (i.e. remove_table_from_cache and
    close_data_files_and_morph_locks)

Which allowed the table to be opened with MYSQL_LOCK_IGNORE_FLUSH flag
resulting in renaming a partition that was already in use,
which could cause the table to be unusable.

Solution was to not allow IGNORE_FLUSH to skip waiting for
a named locked table.

And to not release the LOCK_open mutex between the
calls to remove_table_from_cache and
close_data_files_and_morph_locks by merging the functions
abort_and_upgrade_locks and alter_close_tables.

mysql-test/suite/parts/r/partition_debug_sync_innodb.result:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Added test result
mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Added test option
mysql-test/suite/parts/t/partition_debug_sync_innodb.test:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Added test file
sql/authors.h:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Time to be acknowledged :)
sql/ha_partition.cc:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Added DEBUG_SYNC for deterministic testing
sql/mysql_priv.h:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Renamed function since merging alter_close_tables into
  abort_and_upgrade_lock.
sql/sql_base.cc:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Changed MYSQL_LOCK_IGNORE_FLUSH to not ignore name locks
  (open_placeholder).
  
  Merged alter_close_tables into abort_and_upgrade_locks
  (and added _and_close_table to the name)
  to not release LOCK_open between remove_table_from_cache
  and close_data_files_and_morph_locks.
  
  Added DEBUG_SYNC for deterministic testing.
sql/sql_partition.cc:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Removed alter_close_tables, (merged it into
  abort_and_upgrad_lock) so that LOCK_open never is released
  between remove_table_from_cache and
  close_data_files_and_morph_locks.
sql/sql_show.cc:
  Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
  concurrent I_S query
  
  Added DEBUG_SYNC for deterministic testing
2010-03-17 15:10:41 +01:00
Mattias Jonsson
e62c30b5f8 merge 2010-03-12 11:52:38 +01:00
Mattias Jonsson
29b39e7a44 Bug#51830: Incorrect partition pruning on range partition
(regression)

Problem was that partition pruning did not exclude the
last partition if the range was beyond it
(i.e. not using MAXVALUE)

Fix was to not include the last partition if the
partitioning function value was not within the partition
range.

mysql-test/r/partition_innodb.result:
  Bug#51830: Incorrect partition pruning on range partition
  (regression)
  
  Updated result
mysql-test/r/partition_pruning.result:
  Bug#51830: Incorrect partition pruning on range partition
  (regression)
  
  Updated result
mysql-test/t/partition_innodb.test:
  Bug#51830: Incorrect partition pruning on range partition
  (regression)
  
  Added test for pruning in InnoDB, since it does not show
  for MyISAM due to 'Impossible WHERE noticed after reading
  const tables'.
mysql-test/t/partition_pruning.test:
  Bug#51830: Incorrect partition pruning on range partition
  (regression)
  
  Added test
sql/sql_partition.cc:
  Bug#51830: Incorrect partition pruning on range partition
  (regression)
  
  Also increase the partition id if not inside the last partition
  (and no MAXVALUE is defined).
  
  Added comments and DBUG_ASSERT.
2010-03-10 12:56:05 +01:00
unknown
c9dffa993a A number of after-merge fixes following merge of MySQL 5.1.44 into MariaDB.
Bug#46949: memory leak with failed alter table to create partitions based on extract()

Bug#51830: Incorrect partition pruning on range partition (regression)

Fixed valgrind failure in select_describe(), read of uninitialized 
  Item_subselect::eliminated.

PBXT test file updates to reflect changes done in MySQL.

mysql-test/suite/pbxt/r/partition_error.result:
  Result file update following MySQL 5.1.44 changes.
mysql-test/suite/pbxt/r/partition_pruning.result:
  Result file update following MySQL 5.1.44 changes.
mysql-test/suite/pbxt/t/partition_error.test:
  Test file update following MySQL 5.1.44 changes.
sql/item_subselect.cc:
    Fixed valgrind failure in select_describe(), read of uninitialized 
    Item_subselect::eliminated: 
    - it turns out we can call select_describe() without having fixed 
      subquery items for child subselects. These are not the kind of subqueries
      that we could eliminate, so the fix is to ensure that 
      item_subselect->eliminated==FALSE even before fix_fields is called.
      Also added code to reset item_subselect->eliminated back to FALSE in
      Item::reset() call.
sql/item_subselect.h:
    Fixed valgrind failure in select_describe(), read of uninitialized 
    Item_subselect::eliminated: 
    - it turns out we can call select_describe() without having fixed 
      subquery items for child subselects. These are not the kind of subqueries
      that we could eliminate, so the fix is to ensure that 
      item_subselect->eliminated==FALSE even before fix_fields is called.
      Also added code to reset item_subselect->eliminated back to FALSE in
      Item::reset() call.
sql/sql_partition.cc:
  Fix Bug#51830: Revert part of the patch for Bug#49742, which caused the regression.
sql/table.cc:
  Fix Bug#46949: memory leak in failed ALTER TABLE with partitioning.
2010-03-09 16:03:54 +01:00
Mattias Jonsson
48d986f511 Bug#50104: Partitioned table with just 1 partion works with fk
There was no check for foreign keys when altering partitioned
tables.

Added check for FK when altering partitioned tables.

mysql-test/r/partition_innodb.result:
  Bug#50104: Partitioned table with just 1 partion works with fk
  
  Updated test result
mysql-test/t/partition_innodb.test:
  Bug#50104: Partitioned table with just 1 partion works with fk
  
  Added test for adding FK on partitioned tables (both 1 and 2
  partitions)
sql/sql_partition.cc:
  Bug#50104: Partitioned table with just 1 partion works with fk
  
  Disabled adding foreign key when altering a partitioned table.
2010-03-04 12:29:22 +01:00
unknown
4bf849c23c Merge MySQL 5.1.44 into MariaDB. 2010-03-04 09:03:07 +01:00
Sergei Golubchik
f09ca00e08 merged 2010-03-15 12:51:23 +01:00
unknown
e5099a2c85 merge 5.1->5.2 2010-02-01 08:14:12 +02:00
He Zhenxing
2b16517522 Backport Bug#37148 to 5.1 2010-01-24 15:03:23 +08:00
Michael Widenius
d8ecbbe634 Merge with MySQL 5.1.42
- Marked a couple of tests with --big
- Fixed xtradb/handler/ha_innodb.cc to call explain_filename()

storage/xtradb/handler/ha_innodb.cc:
  Call explain_filename() to get proper names for partitioned tables
2010-01-15 17:27:55 +02:00
Mattias Jonsson
8c6d6c0c6c merge 2010-01-19 12:18:48 +01:00
Mattias Jonsson
eab2be0aee Bug#47343: InnoDB fails to clean-up after lock wait timeout on
REORGANIZE PARTITION

There were several problems which lead to this this,
all related to bad error handling.

1) There was several bugs preventing the ddl-log to be used for
   cleaning up created files on error.

2) The error handling after the copy partition rows did not close
   and unlock the tables, resulting in deletion of partitions
   which were in use, which lead InnoDB to put the partition to
   drop in a background queue.

sql/ha_partition.cc:
  Bug#47343: InnoDB fails to clean-up after lock wait timeout on
             REORGANIZE PARTITION
  
  Better error handling, if partition has been created/opened/locked
  then make sure it is unlocked and closed before returning error.
  The delete of the newly created partition is handled by the ddl-log.
sql/sql_parse.cc:
  Bug#47343: InnoDB fails to clean-up after lock wait timeout on
             REORGANIZE PARTITION
  
  Fix a bug found when experimenting, thd could really be NULL here,
  as mentioned in the function header.
sql/sql_partition.cc:
  Bug#47343: InnoDB fails to clean-up after lock wait timeout on
             REORGANIZE PARTITION
  
  Used the correct .frm shadow name to put into the ddl-log.
  Really use the ddl-log to handle errors.
sql/sql_table.cc:
  Bug#47343: InnoDB fails to clean-up after lock wait timeout on
             REORGANIZE PARTITION
  
  Fixes of the ddl-log when used as error recovery (no crash).
  When executing an entry from memory (not read from disk)
  the name_len was not set correctly.
2010-01-18 17:49:18 +01:00
Mattias Jonsson
28e64daf2d Bug#49742: Partition Pruning not working correctly for RANGE
Problem was when calculating the range of partitions for
pruning.

Solution was to get the calculation correct. I also simplified
it a bit for easier understanding.

mysql-test/r/partition_pruning.result:
  Bug#49742: Partition Pruning not working correctly for RANGE
  
  Added results.
mysql-test/t/partition_pruning.test:
  Bug#49742: Partition Pruning not working correctly for RANGE
  
  Added tests to prevent regressions.
sql/sql_partition.cc:
  Bug#49742: Partition Pruning not working correctly for RANGE
  
  Simplified calculation for partition id for ranges.
  Easier to get right and understand.
  
  Added comments.
2009-12-22 18:59:37 +01:00
Alexey Kopytov
d65fdb3168 Automerge 2009-12-13 23:57:57 +03:00
Alexey Kopytov
c08e6c8867 Bug #42849: innodb crash with varying time_zone on partitioned
timestamp primary key 
 
Since TIMESTAMP values are adjusted by the current time zone  
settings in both numeric and string contexts, using any 
expressions involving TIMESTAMP values as a  
(sub)partitioning function leads to undeterministic behavior of  
partitioned tables. The effect may vary depending on a storage  
engine, it can be either incorrect data being retrieved or  
stored, or an assertion failure. The root cause of this is the  
fact that the calculated partition ID may differ from a  
previously calculated ID for the same data due to timezone  
adjustments of the partitioning expression value. 
 
Fixed by disabling any expressions involving TIMESTAMP values  
to be used in partitioning functions with the follwing two 
exceptions: 
 
1. Creating or altering into a partitioned table that violates 
the above rule is not allowed, but opening existing such tables 
results in a warning rather than an error so that such tables 
could be fixed. 
 
2. UNIX_TIMESTAMP() is the only way to get a 
timezone-independent value from a TIMESTAMP column, because it 
returns the internal representation (a time_t value) of a 
TIMESTAMP argument verbatim. So UNIX_TIMESTAMP(timestamp_column)
is allowed and should be used to fix existing tables if one 
wants to use TIMESTAMP columns with partitioning.

mysql-test/r/partition_bug18198.result:
  Corrected the error.
mysql-test/r/partition_error.result:
  Corrected error texts.
  Added test cases for bug #42849.
mysql-test/t/partition_bug18198.test:
  Corrected error code.
mysql-test/t/partition_error.test:
  Corrected error codes.
  Added test cases for bug #42849.
sql/item.h:
  Added is_timezone_dependent_processor() to Item.
sql/item_func.h:
  Added has_timestamp_args() and the implementation of
  is_timezone_dependent_processor() for Item_func.
sql/item_timefunc.h:
  Added is_timezone_dependent_processor() to 
  Item_func_unix_timestamp.
sql/share/errmsg.txt:
  Renamed ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR to
  ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR to better reflect the
  meaning. Adjusted the error message.
sql/sql_partition.cc:
  Modified fix_fields_part_func() to walk through partitioning
  expression tree with is_timezone_dependent_processor() and issue
  a warning/error if it depends on the timezone settings.
  
  Changed fix_fields_part_func() to a static function since it is
  not used anywhere except sql_partition.cc
sql/sql_partition.h:
  Removed the unneeded declaration of fix_fields_part_func()
  since it is now a static function.
sql/sql_yacc.yy:
  ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR ->
  ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR.
2009-12-13 23:29:50 +03:00
unknown
08e4635fba merge 5.1-> 5.2 2009-12-08 23:47:54 +02:00
Mattias Jonsson
3faaf33333 merge 2009-11-17 22:51:49 +01:00
Mattias Jonsson
7a6ab645ab merge 2009-11-17 22:48:28 +01:00
Mattias Jonsson
98fd304278 backport of bug#45904 from mysql-pe to 5.1
sql/sql_partition.cc:
  Bug#45904 Used list_of_part_fields instead of list_of_subpart_fields to discover if KEY subpartitioning => caused failure when charset=utf8 even for subpartitioning by key, would also allow for subpartitioning by hash with utf8 erroneously
2009-11-17 22:47:34 +01:00
Mattias Jonsson
e6d02a127e merge 2009-11-17 16:24:46 +01:00
unknown
a962160eec Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.

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

This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
2009-11-16 21:49:51 +01:00
Igor Babaev
d749c7e600 Merge 2009-11-09 18:32:39 -08:00
Mattias Jonsson
785b5c4e7a Bug#48276: can't add column if subpartition exists
Bug when setting up default partitioning,
used an uninitialized variabe.

mysql-test/r/partition.result:
  Bug#48276: can't add column if subpartition exists
  
  Added result
mysql-test/t/partition.test:
  Bug#48276: can't add column if subpartition exists
  
  Added test
sql/sql_partition.cc:
  Bug#48276: can't add column if subpartition exists
  
  even if is_create_table_ind was set, one tried to set no_subparts
  with the unitialized no_parts local variable.
  
  Fixed by rearrange the code to be to only execute
  the statements when is_create_table_ind was not set.
2009-11-09 11:26:01 +01:00