Commit graph

101 commits

Author SHA1 Message Date
Sergei Golubchik
82e9f6d948 Merge remote-tracking branch 'mysql/5.5' into 5.5 2015-10-08 22:54:24 +02:00
Debarun Banerjee
0eadadad25 BUG#20310212 PARTITION DDL- CRASH AFTER THD::NOCHECK_REGISTER_ITEM_
Problem :
---------
Issue-1: The root cause for the issues is that (col1 > 1) is not a
valid partition function and we should have thrown error at much early
stage [partition_info::check_partition_info]. We are not checking
sub-partition expression when partition expression is NULL.

Issue-2: Potential issue for future if any partition function needs to
change item tree during open/fix_fields. We should release changed
items, if any, before doing closefrm when we open the partitioned table
during creation in create_table_impl.

Solution :
----------
1.check_partition_info() - Check for sub-partition expression even if no
partition expression.
[partition by ... columns(...) subpartition by hash(<expr>)]

2.create_table_impl() - Assert that the change list is empty before doing
closefrm for partitioned table. Currently no supported partition function
seems to be changing item tree during open.

Reviewed-by: Mattias Jonsson <mattias.jonsson@oracle.com>

RB: 9345
2015-06-24 10:27:12 +05:30
Sergei Golubchik
5d0122bd77 MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor
MDEV-6789 segfault in Item_func_from_unixtime::get_date on updating table with virtual columns

* prohibit VALUES in partitioning expression
* prohibit user and system variables in virtual column expressions
* fix Item_func_date_format to cache locale (for %M/%W to return the same as MONTHNAME/DAYNAME)
* fix Item_func_from_unixtime to cache time_zone directly, not THD (and not to crash)
* added tests for other incorrectly allowed (in vcols) functions to see that they don't crash
2014-11-18 15:42:40 +01:00
Sergei Golubchik
20e706689d mysql-5.5.22 merge
mysql-test/suite/innodb/t/group_commit_crash.test:
  remove autoincrement to avoid rbr being used for insert ... select
mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test:
  remove autoincrement to avoid rbr being used for insert ... select
mysys/my_addr_resolve.c:
  a pointer to a buffer is returned to the caller -> the buffer cannot be on the stack
mysys/stacktrace.c:
  my_vsnprintf() is ok here, in 5.5
2012-03-28 01:04:46 +02:00
Mattias Jonsson
7ebeb1433e Bug#13593865 - 64037: CRASH IN HA_PARTITION::CREATE_HANDLERS ON
ALTER TABLE AFTER DROP PARTITION
Bug#13608188 - 64038: CRASH IN HANDLER::HA_THD ON ALTER TABLE AFTER
                      REPAIR NON-EXISTING PARTITION

Backport of bug#13357766 from -trunk to -5.5.

The state of some partitions was not reset on failure, leading
to invalid states of partitions in consequent statements.

Fixed by reverting back to original state for all partitions
if not all partition names was resolved.

Also adding extra security by forcing tables to be reopened
in case of error in mysql_alter_table.

(There is also removal of \r at the end of some lines.)
2012-02-02 12:47:17 +01:00
Mattias Jonsson
98d3ef960d Bug#13593865 - 64037: CRASH IN HA_PARTITION::CREATE_HANDLERS ON
ALTER TABLE AFTER DROP PARTITION
Bug#13608188 - 64038: CRASH IN HANDLER::HA_THD ON ALTER TABLE AFTER
                      REPAIR NON-EXISTING PARTITION

Backport of bug#13357766 from -trunk to -5.5.

The state of some partitions was not reset on failure, leading
to invalid states of partitions in consequent statements.

Fixed by reverting back to original state for all partitions
if not all partition names was resolved.

Also adding extra security by forcing tables to be reopened
in case of error in mysql_alter_table.

(There is also removal of \r at the end of some lines.)
2012-02-02 12:47:17 +01:00
Sergei Golubchik
2ccf247e93 after merge changes:
* rename all debugging related command-line options
  and variables to start from "debug-", and made them all
  OFF by default.
* replace "MySQL" with "MariaDB" in error messages
* "Cast ... converted ... integer to it's ... complement"
  is now a note, not a warning
* @@query_cache_strip_comments now has a session scope,
  not global.
2011-12-12 23:58:40 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Sergey Petrunya
7880039fc0 Merge 5.2 -> 5.3
(testcase for #798597 now crashes)
2011-06-24 21:43:31 +04:00
Michael Widenius
ff0b30219f Updated to new error messages for partitions when .par file is missing 2011-06-11 14:53:08 +03:00
Michael Widenius
f197991f41 Merge with 5.1-microseconds
A lot of small fixes and new test cases.

client/mysqlbinlog.cc:
  Cast removed
client/mysqltest.cc:
  Added missing DBUG_RETURN
include/my_pthread.h:
  set_timespec_time_nsec() now only takes one argument
mysql-test/t/date_formats.test:
  Remove --disable_ps_protocl as now also ps supports microseconds
mysys/my_uuid.c:
  Changed to use my_interval_timer() instead of my_getsystime()
mysys/waiting_threads.c:
  Changed to use my_hrtime()
sql/field.h:
  Added bool special_const_compare() for fields that may convert values before compare (like year)
sql/field_conv.cc:
  Added test to get optimal copying of identical temporal values.
sql/item.cc:
  Return that item_int is equal if it's positive, even if unsigned flag is different.
  Fixed Item_cache_str::save_in_field() to have identical null check as other similar functions
  Added proper NULL check to Item_cache_int::save_in_field()
sql/item_cmpfunc.cc:
  Don't call convert_constant_item() if there is nothing that is worth converting.
  Simplified test when years should be converted
sql/item_sum.cc:
  Mark cache values in Item_sum_hybrid as not constants to ensure they are not replaced by other cache values in compare_datetime()
sql/item_timefunc.cc:
  Changed sec_to_time() to take a my_decimal argument to ensure we don't loose any sub seconds.
  Added Item_temporal_func::get_time() (This simplifies some things)
sql/mysql_priv.h:
  Added Lazy_string_decimal()
sql/mysqld.cc:
  Added my_decimal constants max_seconds_for_time_type, time_second_part_factor
sql/table.cc:
  Changed expr_arena to be of type CONVENTIONAL_EXECUTION to ensure that we don't loose any items that are created by fix_fields()
sql/tztime.cc:
  TIME_to_gmt_sec() now sets *in_dst_time_gap in case of errors
  This is needed to be able to detect if timestamp is 0
storage/maria/lockman.c:
  Changed from my_getsystime() to set_timespec_time_nsec()
storage/maria/ma_loghandler.c:
  Changed from my_getsystime() to my_hrtime()
storage/maria/ma_recovery.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/maria/unittest/trnman-t.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/xtradb/handler/ha_innodb.cc:
  Added support for new time,datetime and timestamp
unittest/mysys/thr_template.c:
  my_getsystime() -> my_interval_timer()
unittest/mysys/waiting_threads-t.c:
  my_getsystime() -> my_interval_timer()
2011-05-28 05:11:32 +03:00
Mattias Jonsson
92c6bc5e14 Backport of bug#11891417 from mysql-trunk to mysql-5.5 2011-03-31 14:38:54 +02:00
Mattias Jonsson
cfdb759722 Backport of bug#11891417 from mysql-trunk to mysql-5.5 2011-03-31 14:38:54 +02:00
Mattias Jonsson
ec5e43da33 merge 2011-01-26 16:50:21 +01:00
Mattias Jonsson
6ae9810f38 merge of bug 47902 and (null-merge) of bug 57924.
bug#57924 does not occur in 5.5, so I reverted the 5.1 specific
code and used the errors from 5.5 instead in the tests
2011-01-26 19:33:53 +01:00
Mattias Jonsson
04a8611112 merge of bug 47902 and (null-merge) of bug 57924.
bug#57924 does not occur in 5.5, so I reverted the 5.1 specific
code and used the errors from 5.5 instead in the tests
2011-01-26 19:33:53 +01:00
Mattias Jonsson
4e47db3af4 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
9ecf315679 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.
2011-01-10 16:20:28 +01:00
Mattias Jonsson
b56308e63d Manual merge from 5.1 2011-01-10 15:08:31 +01:00
Mattias Jonsson
1a46e493dd Manual merge from 5.1 2011-01-10 15:08:31 +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
Mattias Jonsson
966d0ebaf3 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).
2010-12-22 10:50:36 +01:00
Alexey Kopytov
d72c594739 Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.
conflicts:
   conflict      dbug/dbug.c
   conflict      sql/sql_load.cc
2010-10-02 00:12:27 +04:00
Alexey Kopytov
49e715258f Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.
conflicts:
   conflict      dbug/dbug.c
   conflict      sql/sql_load.cc
2010-10-02 00:12:27 +04:00
Mattias Jonsson
e33e27a664 Minor update of test to pass both with and without --ps-protocol 2010-10-01 21:32:40 +02:00
Mattias Jonsson
16076e6a6f Minor update of test to pass both with and without --ps-protocol 2010-10-01 21:32:40 +02:00
Mattias Jonsson
29acd77643 minor test result update after merge 2010-10-01 18:10:45 +02:00
Mattias Jonsson
790dd097c3 minor test result update after merge 2010-10-01 18:10:45 +02:00
Alexey Kopytov
faf54ff95c Bug #56709: Memory leaks at running the 5.1 test suite
Fixed a number of memory leaks discovered by valgrind.

dbug/dbug.c:
  This is actually an addendum to the fix for bug #52629:
  
  - there is no point in limiting the fix to just global
  variables, session ones are also affected.
  - zero all fields when allocating a new 'state' structure so
  that FreeState() does not deal with unitialized data later.
  - add a check for a NULL pointer in DBUGCloseFile()
mysql-test/r/partition_error.result:
  Added a test case for bug #56709.
mysql-test/r/variables_debug.result:
  Added a test case for bug #56709.
mysql-test/t/partition_error.test:
  Added a test case for bug #56709.
mysql-test/t/variables_debug.test:
  Added a test case for bug #56709.
sql/item_timefunc.cc:
  There is no point in declaring 'value' as a member of
  Item_extract and dynamically allocating memory for it in
  Item_extract::fix_length_and_dec(), since this string is only
  used as a temporary storage in Item_extract::val_int().
sql/item_timefunc.h:
  Removed 'value' from the Item_extract class definition.
sql/sql_load.cc:
  - we may need to deallocate 'buffer' even when 'error' is
    non-zero in some cases, since 'error' is public, and there is
    external code modifying it.
  - assign NULL to buffer when deallocating it so that we don't
    do it twice in the destructor
  - there is no point in changing 'error' in the destructor.
2010-09-22 23:33:18 +04:00
Alexey Kopytov
a1f1e77c38 Bug #56709: Memory leaks at running the 5.1 test suite
Fixed a number of memory leaks discovered by valgrind.
2010-09-22 23:33:18 +04:00
Mattias Jonsson
86327002fe Bug#50036: Inconsistent errors when using TIMESTAMP columns/expressions
It was hard to understand what the error really meant.

The error checking in partitioning is done in several different
parts during the execution of a query which can make it
hard to return useful errors.

Added a new error for bad VALUES part in the per PARTITION clause.
Using the more verbose error that a column is not allowed in
the partitioning function instead of just that the function is
not allowed.

mysql-test/r/partition.result:
  changed error to be more specific
mysql-test/r/partition_error.result:
  updated result
mysql-test/std_data/parts/t1TIMESTAMP.frm:
  .frm file of CREATE TABLE t1 (a TIMESTAMP) PARTITION BY HASH(TO_DAYS(a));
mysql-test/t/partition.test:
  changed error to be more specific
mysql-test/t/partition_error.test:
  Added test (also for verifying behaviour of previously
  created tables which is no longer allowed).
  
  Updated expected errors in other places
sql/partition_info.cc:
  Added function report_part_expr_error to
  be able to return a more specific error.
  
  Renamed fix_func_partition to fix_partition_values
  since the function really fixes/checks the VALUES clause.
sql/partition_info.h:
  removed part_result_type, since it was unused.
  renamed fix_funk_partition->fix_partition_values
  added report_part_expr_error
sql/share/errmsg-utf8.txt:
  Added a more specific error.
sql/sql_partition.cc:
  made use of report_part_expr_error to get a more specific error.
sql/sql_yacc.yy:
  Changed error message to be more specific. And return an other error code.
2010-08-30 17:33:55 +02:00
Mattias Jonsson
e7dc80b807 Bug#50036: Inconsistent errors when using TIMESTAMP columns/expressions
It was hard to understand what the error really meant.

The error checking in partitioning is done in several different
parts during the execution of a query which can make it
hard to return useful errors.

Added a new error for bad VALUES part in the per PARTITION clause.
Using the more verbose error that a column is not allowed in
the partitioning function instead of just that the function is
not allowed.
2010-08-30 17:33:55 +02:00
Alexander Nozdrin
f29d24b0f8 Manual merge from mysql-trunk-bugfixing.
Conflicts:
  - BUILD/SETUP.sh
  - mysql-test/mysql-test-run.pl
  - mysql-test/r/partition_error.result
  - mysql-test/t/disabled.def
  - mysql-test/t/partition_error.test
  - sql/share/errmsg-utf8.txt
2010-06-07 12:47:04 +04:00
Alexander Nozdrin
8a247e963d Manual merge from mysql-trunk-bugfixing.
Conflicts:
  - BUILD/SETUP.sh
  - mysql-test/mysql-test-run.pl
  - mysql-test/r/partition_error.result
  - mysql-test/t/disabled.def
  - mysql-test/t/partition_error.test
  - sql/share/errmsg-utf8.txt
2010-06-07 12:47:04 +04:00
Mattias Jonsson
f90429ed99 Manual merge of bug#49161 into mysql-trunk-merge
(Added a real error message instead of ER_UNKNOWN_ERROR)
2010-05-28 15:14:43 +02:00
Mattias Jonsson
7e33652495 Manual merge of bug#49161 into mysql-trunk-merge
(Added a real error message instead of ER_UNKNOWN_ERROR)
2010-05-28 15:14:43 +02:00
Mattias Jonsson
2abf030a12 merge 2010-05-25 17:26:48 +02:00
Mattias Jonsson
e596ae0795 merge 2010-05-25 17:26:48 +02:00
Mattias Jonsson
42d91c688c merge 2010-05-25 15:45:01 +02:00
Mattias Jonsson
427436d4b8 merge 2010-05-25 15:45:01 +02:00
Mattias Jonsson
0fdd97af48 Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
Problem was reporting wrong error

Fixed by adding a new error which better explain the problem.

mysql-test/r/partition_error.result:
  Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
  
  Updated test result
mysql-test/t/partition_error.test:
  Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
  
  Added test case
sql/ha_partition.cc:
  Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
  
  Better error message. (used ER_UNKNOWN_ERROR to avoid merge
  problems in mysql-trunk+)
2010-05-25 15:41:00 +02:00
Mattias Jonsson
ff36f028c3 Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
Problem was reporting wrong error

Fixed by adding a new error which better explain the problem.
2010-05-25 15:41:00 +02:00
Mattias Jonsson
6ef03ea37c merge into mysql-5.1-bugteam
sql/ha_partition.cc:
  Bug#49477, added safety that a partitioned table cannot be
  temporary.
2010-05-21 14:18:14 +02:00
Mattias Jonsson
ae171f1e40 merge into mysql-5.1-bugteam 2010-05-21 14:18:14 +02:00
Alexey Kopytov
5d407d0c1a Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/r/partition_innodb.result
Text conflict in sql/field.h
Text conflict in sql/item.h
Text conflict in sql/item_cmpfunc.h
Text conflict in sql/item_sum.h
Text conflict in sql/log_event_old.cc
Text conflict in sql/protocol.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_yacc.yy
2010-03-20 23:23:42 +03:00
Alexey Kopytov
acc2b9e366 Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/r/partition_innodb.result
Text conflict in sql/field.h
Text conflict in sql/item.h
Text conflict in sql/item_cmpfunc.h
Text conflict in sql/item_sum.h
Text conflict in sql/log_event_old.cc
Text conflict in sql/protocol.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_yacc.yy
2010-03-20 23:23:42 +03:00
Mattias Jonsson
b183e7c5a2 Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with subpartitions
There was no check for DATA/INDEX DIRECTORY for subpartitions

Added the same check as for partitions.

mysql-test/r/partition_error.result:
  Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with subpartitions
  
  Updated results
mysql-test/t/partition_error.test:
  Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with subpartitions
  
  Added tests
sql/partition_info.cc:
  Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with subpartitions
  
  moved the check for DATA/INDEX DIRECTORY into a function
  and used it for both partitions as well as subpartitions.
  (Was not checked at all for subpartitions before)
2010-03-11 14:00:36 +01:00
Mattias Jonsson
90c200a216 Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with subpartitions
There was no check for DATA/INDEX DIRECTORY for subpartitions

Added the same check as for partitions.
2010-03-11 14:00:36 +01:00
Mattias Jonsson
1f77c7b49a Bug#50392: insert_id is not reset for partitioned tables
auto_increment on duplicate entry

The bug was that when INSERT_ID was used and the storage
engine was told to release any reserved but not used
auto_increment values, it set the highest auto_increment
value to INSERT_ID.

The fix was to check if the auto_increment value was forced
by user (INSERT_ID) or by slave-thread, i.e. not auto-
generated. So that it is only allowed to release generated
values.

mysql-test/r/partition_error.result:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  updated result
mysql-test/suite/parts/inc/partition_auto_increment.inc:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added test
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added result, note that archive does only allow increasing
  auto_increment values
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added result, note that blackhole accepts all inserts :)
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added result, note that innodb rolls back inserts on error,
  but keeps the auto_increment value.
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added result, note that memory and myisam inserts all rows
  before the error.
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added result, note that memory and myisam inserts all rows
  before the error.
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added result, note that NDB does not seem to handle
  INSERT_ID as other engines. (Martin will look into it).
mysql-test/t/partition_error.test:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  Added test
sql/ha_partition.cc:
  Bug#50392: insert_id is not reset for partitioned tables
  auto_increment on duplicate entry
  
  If the next_insert_id comes from non generated (i.e
  forced by INSERT_ID or slave-thread) then we cannot
  lower the reserved auto_increment value, since it have
  not reserved any values.
2010-03-04 18:16:10 +01:00