summaryrefslogtreecommitdiff
path: root/sql/ha_partition.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-3/+3
|\
| * Code comment spellfixesIan Gilfillan2020-07-221-3/+3
| |
* | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
|\ \ | |/
| * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| |\
| | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | * Update wrong zip-code
* | | MDEV-16429: Assertion `!table || (!table->read_set || ↵Nikita Malyavin2018-12-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap_is_set(table->read_set, field_index))' fails upon attempt to update virtual column on partitioned versioned table When using buffered sort in `UPDATE`, keyread is used. In this case, `TABLE::update_virtual_field` should be aborted, but it actually isn't, because it is called not with a top-level handler, but with the one that is actually going to access the disk. Here the problemm is issued with partitioning, so the solution is to recursively mark for keyread all the underlying partition handlers. * ha_partition: update keyread state for child partitions Closes #800
* | | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-1/+0
|\ \ \ | |/ /
| * | Merge branch '10.0' into 10.1Sergei Golubchik2018-10-301-1/+0
| |\ \
| | * | Remove unused code.Sergey Vojtovich2018-10-191-1/+0
| | | |
| * | | MDEV-16912: Spider Order By column[datatime] limit 5 returns 3 rowsJacob Mathew2018-09-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem occurs in 10.2 and earlier releases of MariaDB Server because the Partition Engine was not pushing the engine conditions to the underlying storage engine of each partition. This caused Spider to return the first 5 rows in the table with the data provided by the customer. 2 of the 5 rows did not qualify the WHERE clause, so they were removed from the result set by the server. To fix the problem, I have back-ported support for engine condition pushdown in the Partition Engine from MariaDB Server 10.3. Author: Jacob Mathew. Reviewer: Kentoku Shiba. Cherry-Picked: Commit eb2ca3d on branch bb-10.2-MDEV-16912
* | | | MDEV-16912: Spider Order By column[datatime] limit 5 returns 3 rowsbb-10.2-MDEV-16912Jacob Mathew2018-09-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem occurs in 10.2 and earlier releases of MariaDB Server because the Partition Engine was not pushing the engine conditions to the underlying storage engine of each partition. This caused Spider to return the first 5 rows in the table with the data provided by the customer. 2 of the 5 rows did not qualify the WHERE clause, so they were removed from the result set by the server. To fix the problem, I have back-ported support for engine condition pushdown in the Partition Engine from MariaDB Server 10.3. Author: Jacob Mathew. Reviewer: Kentoku Shiba.
* | | | Merge branch '10.1' into 10.2Vicențiu Ciorbaru2017-09-191-0/+4
|\ \ \ \ | |/ / /
| * | | MDEV-13157 Specifying DATA DIRECTORY in tables leads to failing EXCHANGE ↵Sergei Golubchik2017-09-181-0/+4
| | | | | | | | | | | | | | | | PARTITION
* | | | cleanup: generate_partition_syntax()Sergei Golubchik2017-07-051-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | Don't write to a temporary file, use String. Remove strange one-liner "helpers", use String methods. Don't use current_thd, don't allocate memory for 1-byte strings, etc.
* | | | MariaRocks port: Remove handler::init_with_fieldsSergei Petrunia2017-01-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - It turns out, ha_rocksdb::table_flags() can return HA_PRIMARY_KEY_IN_READ_INDEX for all kinds of tables (as its meaning is "if there is a PK, PK columns contribute to the secondary index tuple". There is no assumption that a certain PK column can be decoded from the secondary index. (Should probably be fixed in the upstream, too, but I was unable to construct a testcase showing this is necessary). - Following the above, we can undo the init_with_fields() changes in table.cc. MyRocks calls init_with_fields() from ha_rocksdb::open() which sets index-only read capabilities properly.
* | | | Merge branch '10.2' of github.com:MariaDB/server into 10.2-mariarocksSergei Petrunia2017-01-021-6/+0
|\ \ \ \ | | | | | | | | | | | | | | | and a few trivial test result updates
| * | | | cleanup: extra_rec_buf_lengthSergei Golubchik2016-12-121-6/+0
| | | | |
* | | | | MariaRocks port: Return correct value of HA_PRIMARY_KEY_IN_READ_INDEX flagSergei Petrunia2016-12-021-0/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This cset just re-uses the approach from facebook/mysql-5.6 (Perhaps we will have something different for MariaDB in the end). For now this is: Port this fix dd7eeae69503cb8ab6ddc8fd9e2fef451cc31a32 Issue#250: MyRocks/Innodb different output from query with order by on table with index and decimal type Summary: Make open_binary_frm() set TABLE_SHARE::primary_key before it computes Also add the patch for https://github.com/facebook/mysql-5.6/issues/376
* | | | various cleanupsSergei Golubchik2016-06-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remove a confusing method name - Field::set_default_expression() * remove handler::register_columns_for_write() * rename stuff * add asserts * remove unlikely unlikely * remove redundant if() conditions * fix mark_unsupported_function() to report the most important violation * don't scan vfield list for default values (vfields don't have defaults) * move handling for DROP CONSTRAINT IF EXIST where it belongs * don't protect engines from Alter_inplace_info::ALTER_ADD_CONSTRAINT * comments
* | | | MDEV-7563 Support CHECK constraint as in (or close to) SQL StandardMichael Widenius2016-06-301-0/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-10134 Add full support for DEFAULT - Added support for using tables with MySQL 5.7 virtual fields, including MySQL 5.7 syntax - Better error messages also for old cases - CREATE ... SELECT now also updates timestamp columns - Blob can now have default values - Added new system variable "check_constraint_checks", to turn of CHECK constraint checking if needed. - Removed some engine independent tests in suite vcol to only test myisam - Moved some tests from 'include' to 't'. Should some day be done for all tests. - FRM version increased to 11 if one uses virtual fields or constraints - Changed to use a bitmap to check if a field has got a value, instead of setting HAS_EXPLICIT_VALUE bit in field flags - Expressions can now be up to 65K in total - Ensure we are not refering to uninitialized fields when handling virtual fields or defaults - Changed check_vcol_func_processor() to return a bitmap of used types - Had to change some functions that calculated cached value in fix_fields to do this in val() or getdate() instead. - store_now_in_TIME() now takes a THD argument - fill_record() now updates default values - Add a lookahead for NOT NULL, to be able to handle DEFAULT 1+1 NOT NULL - Automatically generate a name for constraints that doesn't have a name - Added support for ALTER TABLE DROP CONSTRAINT - Ensure that partition functions register virtual fields used. This fixes some bugs when using virtual fields in a partitioning function
* | | MDEV-34 delete storage/ndb and sql/*ndb* (and collateral changes)Sergei Golubchik2014-10-111-17/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | remove: * NDB from everywhere * IM from mtr-v1 * packaging/rpm-oel and packaging/rpm-uln * few unused spec files * plug.in file * .bzrignore
* | | cleanup: galera merge, simple changesSergei Golubchik2014-10-011-3/+0
| | |
* | | MDEV-6247: Merge 10.0-galera to 10.1.Jan Lindström2014-08-261-1/+3
|/ / | | | | | | | | | | | | | | | | Merged lp:maria/maria-10.0-galera up to revision 3879. Added a new functions to handler API to forcefully abort_transaction, producing fake_trx_id, get_checkpoint and set_checkpoint for XA. These were added for future possiblity to add more storage engines that could use galera replication.
* | 5.5 mergeSergei Golubchik2014-03-261-0/+21
|\ \ | |/
| * MDEV-5177: ha_partition and innodb index intersection produce fewer rows ↵Sergey Petrunya2014-03-111-0/+21
| | | | | | | | | | | | | | | | | | (MySQL Bug#70703) (This is attempt at fix #2) (re-commit with fixed typo) - Moved the testcase from partition_test to partition_innodb.test where it can really work. - Made ordered index scans over ha_partition tables to satisfy ROR property for the case where underlying table uses extended keys.
* | 10.0-base mergeSergei Golubchik2014-02-031-1/+2
|\ \
| * \ 5.5 mergeSergei Golubchik2014-02-011-1/+2
| |\ \ | | |/
| | * MySQL-5.5.35 mergeSergei Golubchik2014-01-221-1/+2
| | |\
| | | * Bug #16051817 GOT ERROR 124 FROM STORAGE ENGINE Aditya A2013-10-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ON DELETE FROM A PARTITIONED TABLE PROBLEM ------- The user first disables all the non unique indexes in the table and then rebuilds one partition. During rebuild the indexes on that particular partition are enabled. Now when we give a query the optimizer is unaware that on one partition indexes are enabled and if the optimizer selects that index,myisam thinks that the index is not active and gives an error. FIX --- Before rebuilding a partition check whether non unique indexes are disabled on the partitons. If they are disabled then after rebuild disable the index on the partition. [Approved by Mattiasj #rb3469]
| * | | 5.5 merge and fixes for compiler/test errorsSergei Golubchik2013-09-181-1/+1
| |\ \ \ | | |/ /
| | * | mysql-5.5.33 mergeSergei Golubchik2013-09-061-1/+1
| | |\ \ | | | |/
| | | * Bug#13548704 ALGORITHM USED FOR DROPPING PARTITIONED TABLE CAN LEADAditya A2013-06-141-1/+1
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TO INCONSISTENCY [Merge from 5.1]
| | | | * Bug#13548704 ALGORITHM USED FOR DROPPING PARTITIONED TABLE CAN LEADAditya A2013-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TO INCONSISTENCY PROBLEM -------- When we drop a partitoned table , we first gather the information about partitions in the table from the table_name.par file and store it in an internal data structure.Then we delete this file and the data in the table. If the server crashes after deleting the file,then after recovering we cannot access the table .Even we cannot drop the table ,because drop algorithm requires par file to read the partition information. FIX --- 1. We move the part of deleting par file after deleting all the table data from the storage egine. 2. During drop operation if we detect that the par file is missing then we delete the .frm file,since there is no way of recovering without par file. [Approved by Mattias rb#2576 ]
* | | | | MDEV-5281 Partitioning issue after upgrade from 10.0.3-1 to 10.0.5-1Sergei Golubchik2013-11-281-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | merged from 5.6: Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING Bug#16589511: MYSQL_UPGRADE FAILS TO WRITE OUT ENTIRE ALTER TABLE ... ALGORITHM= ... STATEMENT Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHEN DOWNGRADED FROM 5.6.11 TO 5.6.10 plus minor changes from 5.6, mainly comments
* | | | | MDEV-4786 merge 10.0-monty -> 10.0Sergei Golubchik2013-08-121-0/+1
| | | | | | | | | | | | | | | | | | | | remove half-applied "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* | | | | 10.0-monty mergeSergei Golubchik2013-07-211-85/+172
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | includes: * remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING" * introduce LOCK_share, now LOCK_ha_data is strictly for engines * rea_create_table() always creates .par file (even in "frm-only" mode) * fix a 5.6 bug, temp file leak on dummy ALTER TABLE
| * | | | | Fixed issues with partitions and create temporary table SELECT ...Michael Widenius2013-07-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merged all ddl_logging code. Merged sql_partition.cc innodb_mysql_lock2.test and partition_cache.test now works. Changed interface to strconvert() to make it easier to use with not \0 terminated strings. sql/sql_partition.cc: Full merge with 5.6 sql/sql_table.cc: Merged all ddl_logging code sql/strfunc.cc: Added from_length argument to strconvert() to make it possible to use without end terminated strings. sql/strfunc.h: Added from_length argument to strconvert() to make it possible to use without end terminated strings.
| * | | | | ha_partition.cc and ha_partition.h are now completely mergedMichael Widenius2013-06-271-52/+40
| | | | | | | | | | | | | | | | | | | | | | | | Added sql_mode_t to simplify merges
| * | | | | Applied all changes from Igor and SanjaMichael Widenius2013-06-151-24/+129
| | | | | |
* | | | | | 10.0-base mergeSergei Golubchik2013-06-061-4/+16
|\ \ \ \ \ \ | | |/ / / / | |/| | | | | | | | | | (without InnoDB - all InnoDB changes were ignored)
| * | | | | 5.5 mergeSergei Golubchik2013-06-061-4/+16
| |\ \ \ \ \ | | | |/ / / | | |/| | |
| | * | | | mysql-5.5.31 mergeSergei Golubchik2013-05-071-4/+16
| | |\ \ \ \ | | | | |/ / | | | |/| |
| | | * | | Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONINGMattias Jonsson2013-01-301-4/+16
| | | |\ \ \ | | | | | |/ | | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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;
* | | | | | 10.0-base mergeSergei Golubchik2013-04-151-8/+3
|\ \ \ \ \ \ | |/ / / / / | | | | | / | |_|_|_|/ |/| | | |
| * | | | dead code, remove unused argumentSergei Golubchik2013-04-091-2/+1
| | | | |
| * | | | rename a handler method to more precisely reflect what kind of a hack it doesSergei Golubchik2013-04-091-2/+2
| | | | |
| * | | | * move bas_ext from the handler to the handlertonSergei Golubchik2013-04-071-4/+0
| | | | | | | | | | | | | | | | | | | | * provide a default bas_ext value of the empty list
* | | | | 10.0-base mergeSergei Golubchik2013-01-311-0/+4
|\ \ \ \ \ | |/ / / /
| * | | | 5.5 mergeSergei Golubchik2013-01-291-0/+4
| |\ \ \ \ | | |/ / /
| | * | | mysql-5.5.29 mergeSergei Golubchik2013-01-151-0/+4
| | |\ \ \ | | | |/ /