summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) fieldbb-10.0-varunVarun Gupta2018-12-191-2/+2
| | | | | | Create a new constant MAX_DATA_LENGTH_FOR_KEY. Replace the value of MAX_KEY_LENGTH to also include the LENGTH and NULL BYTES of a field.
* Fix cmake -DWITH_PARTITION_STORAGE_ENGINE:BOOL=OFFMarko Mäkelä2018-12-131-17/+16
| | | | | | This is a backport of a part of commit 18455ec3f1a9c22977f0ed87233852813b53eb49 from 10.1.
* MDEV-17032: Estimates are higher for partitions of a table with ↵Varun Gupta2018-12-071-0/+17
| | | | | | | | | @@use_stat_tables= PREFERABLY The problem here is EITS statistics does not calculate statistics for the partitions of the table. So a temporary solution would be to not read EITS statistics for partitioned tables. Also disabling reading of EITS for columns that participate in the partition list of a table.
* Merge remote-tracking branch '5.5' into 10.0Vicențiu Ciorbaru2017-12-201-0/+20
|\
| * MDEV-13788 Server crash when issuing bad SQL partition syntaxAlexander Barkov2017-11-201-0/+20
| |
* | Merge branch '5.5' into 10.0Sergei Golubchik2017-10-181-2/+0
|\ \ | |/
| * MDEV-13459 Warnings, when compiling with gcc-7.xSergei Golubchik2017-10-171-2/+0
| | | | | | | | mostly caused by -Wimplicit-fallthrough
* | Merge branch '5.5' into 10.0Sergei Golubchik2017-07-061-6/+8
|\ \ | |/
* | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2017-03-031-1/+1
|\ \ | |/
* | Merge branch '5.5' into 10.0Sergei Golubchik2015-10-091-4/+12
|\ \ | |/
| * Merge remote-tracking branch 'mysql/5.5' into 5.5Sergei Golubchik2015-10-081-4/+12
| |\
| | * BUG#16613004 PARTITIONING DDL, CRASH IN FIELD_VARSTRING::CMP_MAXDebarun Banerjee2015-07-081-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem : --------- The specific issue reported in this bug is with range/list column value that is allocated and initialized by evaluating partition expression(item tree) during execution. After evaluation the range list value is marked fixed [part_column_list_val]. During next execution, we don't re-evaluate the expression and use the old value since it is marked fixed. Solution : ---------- One way to solve the issue is to mark all column values as not fixed during clone so that the expression is always re-evaluated once we attempt partition_info::fix_column_value_functions() after cloning the part_info object during execution of DDL on partitioned table. Reviewed-by: Jimmy Yang <Jimmy.Yang@oracle.com> Reviewed-by: Mattias Jonsson <mattias.jonsson@oracle.com> RB: 9424
| | * BUG#20310212 PARTITION DDL- CRASH AFTER THD::NOCHECK_REGISTER_ITEM_Debarun Banerjee2015-06-241-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Bug#16860588:CRASH WITH CREATE TABLE ... LIKE ..Mattias Jonsson2013-08-121-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | AND PARTITION VALUES IN (NULL) The code assumed there was at least one list element in LIST partitioned table. Fixed by checking the number of list elements.
| | * Bug#16589511: MYSQL_UPGRADE FAILS TO WRITE OUT ENTIREMattias Jonsson2013-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ALTER TABLE ... ALGORITHM= ... STATEMENT The problem was an intermediate buffer of smaller size, which truncated the alter statement. Solved by providing the size of the buffer to be allocated through the function call, instead of using an one-size-fits-all stack buffer inside the function.
| | * Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHENMattias Jonsson2013-02-141-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DOWNGRADED FROM 5.6.11 TO 5.6.10 Problem was new syntax not accepted by previous version. Fixed by adding version comment of /*!50531 around the new syntax. Like this in the .frm file: 'PARTITION BY KEY /*!50611 ALGORITHM = 2 */ () PARTITIONS 3' and also changing the output from SHOW CREATE TABLE to: CREATE TABLE t1 (a INT) /*!50100 PARTITION BY KEY */ /*!50611 ALGORITHM = 1 */ /*!50100 () PARTITIONS 3 */ It will always add the ALGORITHM into the .frm for KEY [sub]partitioned tables, but for SHOW CREATE TABLE it will only add it in case it is the non default ALGORITHM = 1. Also notice that for 5.5, it will say /*!50531 instead of /*!50611, which will make upgrade from 5.5 > 5.5.31 to 5.6 < 5.6.11 fail! If one downgrades an fixed version to the same major version (5.5 or 5.6) the bug 14521864 will be visible again, but unless the .frm is updated, it will work again when upgrading again. Also fixed so that the .frm does not get updated version if a single partition check passes.
| | * Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONINGMattias Jonsson2013-01-301-2/+278
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to an internal change in the server code in between 5.1 and 5.5 (wl#2649) the hash function used in KEY partitioning changed for numeric and date/time columns (from binary hash calculation to character based hash calculation). Also enum/set changed from latin1 ci based hash calculation to binary hash between 5.1 and 5.5. (bug#11759782). These changes makes KEY [sub]partitioned tables on any of the affected column types incompatible with 5.5 and above, since the calculation of partition id differs. Also since InnoDB asserts that a deleted row was previously read (positioned), the server asserts on delete of a row that is in the wrong partition. The solution for this situation is: 1) The partitioning engine will check that delete/update will go to the partition the row was read from and give an error otherwise, consisting of the rows partitioning fields. This will avoid asserts in InnoDB and also alert the user that there is a misplaced row. A detailed error message will be given, including an entry to the error log consisting of both table name, partition and row content (PK if exists, otherwise all partitioning columns). 2) A new optional syntax for KEY () partitioning in 5.5 is allowed: [SUB]PARTITION BY KEY [ALGORITHM = N] (list_of_cols) Where N = 1 uses the same hashing as 5.1 (Numeric/date/time fields uses binary hashing, ENUM/SET uses charset hashing) N = 2 uses the same hashing as 5.5 (Numeric/date/time fields uses charset hashing, ENUM/SET uses binary hashing). If not set on CREATE/ALTER it will default to 2. This new syntax should probably be ignored by NDB. 3) Since there is a demand for avoiding scanning through the full table, during upgrade the ALTER TABLE t PARTITION BY ... command is considered a no-op (only .frm change) if everything except ALGORITHM is the same and ALGORITHM was not set before, which allows manually upgrading such table by something like: ALTER TABLE t PARTITION BY KEY ALGORITHM = 1 () or ALTER TABLE t PARTITION BY KEY ALGORITHM = 2 () 4) Enhanced partitioning with CHECK/REPAIR to also check for/repair misplaced rows. (Also works for ALTER TABLE t CHECK/REPAIR PARTITION) CHECK FOR UPGRADE: If the .frm version is < 5.5.3 and uses KEY [sub]partitioning and an affected column type then it will fail with an message: KEY () partitioning changed, please run: ALTER TABLE `test`.`t1` PARTITION BY KEY ALGORITHM = 1 (a) PARTITIONS 12 (i.e. current partitioning clause, with the addition of ALGORITHM = 1) CHECK without FOR UPGRADE: if MEDIUM (default) or EXTENDED options are given: Scan all rows and verify that it is in the correct partition. Fail for the first misplaced row. REPAIR: if default or EXTENDED (i.e. not QUICK/USE_FRM): Scan all rows and every misplaced row is moved into its correct partitions. 5) Updated mysqlcheck (called by mysql_upgrade) to handle the new output from CHECK FOR UPGRADE, to run the ALTER statement instead of running REPAIR. This will allow mysql_upgrade (or CHECK TABLE t FOR UPGRADE) to upgrade a KEY [sub]partitioned table that has any affected field type and a .frm version < 5.5.3 to ALGORITHM = 1 without rebuild. Also notice that if the .frm has a version of >= 5.5.3 and ALGORITHM is not set, it is not possible to know if it consists of rows from 5.1 or 5.5! In these cases I suggest that the user does: (optional) LOCK TABLE t WRITE; SHOW CREATE TABLE t; (verify that it has no ALGORITHM = N, and to be safe, I would suggest backing up the .frm file, to be used if one need to change to another ALGORITHM = N, without needing to rebuild/repair) ALTER TABLE t <old partitioning clause, but with ALGORITHM = N>; which should set the ALGORITHM to N (if the table has rows from 5.1 I would suggest N = 1, otherwise N = 2) CHECK TABLE t; (here one could use the backed up .frm instead and change to a new N and run CHECK again and see if it passes) and if there are misplaced rows: REPAIR TABLE t; (optional) UNLOCK TABLES;
| | * \ Updated/added copyright headersKent Boortz2011-06-301-2/+2
| | |\ \ | | | |/
| | | * Updated/added copyright headersKent Boortz2011-06-301-2/+4
| | | |
| | * | removed a comment according to the reviewMattias Jonsson2010-10-011-1/+0
| | | |
| | * | Bug#50036: Inconsistent errors when using TIMESTAMP columns/expressionsMattias Jonsson2010-08-301-10/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Merge of mysql-5.1-bugteam into mysql-trunk-merge.Davi Arnaut2010-07-201-2/+0
| | |\ \ | | | |/
| | | * Bug#45288: pb2 returns a lot of compilation warnings on linuxDavi Arnaut2010-07-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Fix warnings flagged by the new warning option -Wunused-but-set-variable that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The option causes a warning whenever a local variable is assigned to but is later unused. It also warns about meaningless pointer dereferences.
| | * | Merge of mysql-5.1-bugteam into mysql-trunk-merge.Davi Arnaut2010-07-091-3/+3
| | |\ \ | | | |/
| | | * Bug#45288: pb2 returns a lot of compilation warnings on linuxDavi Arnaut2010-07-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although the C standard mandates that sprintf return the number of bytes written, some very ancient systems (i.e. SunOS 4) returned a pointer to the buffer instead. Since these systems are not supported anymore and are hopefully long dead by now, simply remove the portability wrapper that dealt with this discrepancy. The autoconf check was causing trouble with GCC.
| | * | Bug#53445: Build with -Wall and fix warnings that it generatesDavi Arnaut2010-05-311-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix various mismatches between function's language linkage. Any particular function that is declared in C++ but should be callable from C must have C linkage. Note that function types with different linkages are also distinct. Thus, if a function type is declared in C code, it will have C linkage (same if declared in a extern "C" block).
| | * | Bug #49829 Many "hides virtual function" warnings with SunStudioTor Didriksen2010-05-311-13/+13
| | | | | | | | | | | | | | | | | | | | Backport from mysql-pe (of those parts which have not been upmerged from 5.1)
| | * | Auto-merge from mysql-trunk.Alexander Nozdrin2010-05-281-2/+2
| | |\ \
| | | * \ Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.Alexey Kopytov2010-05-091-2/+2
| | | |\ \ | | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Text conflict in mysql-test/r/grant.result Text conflict in mysql-test/t/grant.test Text conflict in mysys/mf_loadpath.c Text conflict in sql/slave.cc Text conflict in sql/sql_priv.h
| | | | * Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.Georgi Kodinov2010-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the 5.1 merge and extension of the fix. The server was happily accepting paths in table name in all places a table name is accepted (e.g. a SELECT). This allowed all users that have some privilege over some database to read all tables in all databases in all mysql server instances that the server file system has access to. Fixed by : 1. making sure no path elements are allowed in quoted table name when constructing the path (note that the path symbols are still valid in table names when they're properly escaped by the server). 2. checking the #mysql50# prefixed names the same way they're checked for path elements in mysql-5.0.
| | * | | Bug #53445 Build with -Wall and fix warnings that it generatesTor Didriksen2010-05-261-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Add -Wall to gcc/g++ Fix most warnings reported in dbg and opt mode.
| | * | | mergeMattias Jonsson2010-05-251-14/+26
| | |\ \ \ | | | |/ / | | |/| |
| | | * | Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with subpartitionsMattias Jonsson2010-03-111-14/+26
| | | |/ | | | | | | | | | | | | | | | | There was no check for DATA/INDEX DIRECTORY for subpartitions Added the same check as for partitions.
| | * | WL#5030: Split and remove mysql_priv.hMats Kindahl2010-03-311-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch: - Moves all definitions from the mysql_priv.h file into header files for the component where the variable is defined - Creates header files if the component lacks one - Eliminates all include directives from mysql_priv.h - Eliminates all circular include cycles - Rename time.cc to sql_time.cc - Rename mysql_priv.h to sql_priv.h
| | * | BUG#49591, Fixed version string in SHOW CREATE TABLE to accomodate for ↵Mikael Ronstrom2009-12-171-0/+36
| | | | | | | | | | | | | | | | column list partitioning and new function to_seconds
| | * | BUG#49180, fixed MAXVALUE problemMikael Ronstrom2009-12-021-1/+1
| | | |
| | * | Fix build failure.Alexander Nozdrin2009-11-101-1/+6
| | | |
| | * | Fixed so that character set constants are encoded as hex strings in frm ↵Mikael Ronstrom2009-10-301-2/+0
| | | | | | | | | | | | | | | | file, but as utf8 strings in the same manner as default values in show create table and information schema tables
| | * | Merged WL#3352 into mysql-next-mrMikael Ronstrom2009-10-281-174/+1023
| | |\ \ | | | |/ | | |/|
| | | * BUG#48165, needed to introduce length restrictions on partitioning fields to ↵Mikael Ronstrom2009-10-281-0/+30
| | | | | | | | | | | | | | | | ensure that no stack overruns occur
| | | * Fixed sql_mode issue in BUG#48164, will ignore sql_mode when generating ↵Mikael Ronstrom2009-10-281-1/+11
| | | | | | | | | | | | | | | | constants, also warnings will not be tolerated
| | | * A lot of fixes to make character set work ok, first step to fixing BUG#48163Mikael Ronstrom2009-10-221-0/+34
| | | |
| | | * Added checks for no NULL values in VALUES LESS THAN, added tests for no ↵Mikael Ronstrom2009-10-211-1/+10
| | | | | | | | | | | | | | | | MAXVALUE in VALUES IN
| | | * Fixed test cases with regards to error codesMikael Ronstrom2009-10-211-1/+1
| | | |
| | | * Removed unnecessary call to fix_parser_dataMikael Ronstrom2009-10-211-1/+2
| | | |
| | | * Removed column_list and fixed all issues relating to this changeMikael Ronstrom2009-10-211-90/+123
| | | |
| | | * Merged in latest wl3352 tree, fixed some non-partition build issuesMikael Ronstrom2009-10-191-1/+40
| | | |\
| | | | * Fix for non-partition buildsMikael Ronstrom2009-10-191-0/+20
| | | | |
| | | * | Merged in latest changesMikael Ronstrom2009-10-161-4/+4
| | | |\ \ | | | | |/
| | | | * Fixed review commentsMikael Ronstrom2009-10-161-4/+4
| | | | |