summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.5 into 10.6Marko Mäkelä2022-07-011-12/+1
|\
| * Merge 10.4 into 10.5Marko Mäkelä2022-07-011-12/+1
| |\
| | * Fix most clang-15 -Wunused-but-set-variableMarko Mäkelä2022-07-011-12/+1
| | | | | | | | | | | | | | | | | | Also, refactor trx_i_s_common_fill_table() to remove dead code. Warnings about yynerrs in Bison-generated yyparse() will remain for now.
* | | removed some compiler warningsMonty2022-06-071-1/+1
| | |
* | | Merge 10.5 into 10.6Marko Mäkelä2022-06-021-0/+2
|\ \ \ | |/ /
| * | Merge 10.4 into 10.5Marko Mäkelä2022-06-021-0/+2
| |\ \ | | |/
| | * Remove compiler warning about unused variablesMonty2022-05-301-0/+2
| | |
* | | Merge branch '10.5' into 10.6mariadb-10.6.8Sergei Golubchik2022-05-181-2/+0
|\ \ \ | |/ /
| * | Merge branch '10.4' into 10.5mariadb-10.5.16Sergei Golubchik2022-05-181-2/+0
| |\ \ | | |/
| | * MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_endAleksey Midenkov2022-05-181-2/+0
| | | | | | | | | | | | | | | We cannot permanently change bits in read_partitions in the middle of processing because ha_rnd_init()/ha_rnd_end() depends on that.
* | | Merge branch '10.5' into 10.6Sergei Golubchik2022-05-101-16/+47
|\ \ \ | |/ /
| * | Merge branch '10.4' into 10.5Sergei Golubchik2022-05-091-16/+47
| |\ \ | | |/
| | * MDEV-20077 Warning on full history partition is delayed until next DML statementAleksey Midenkov2022-04-291-10/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved LIMIT warning from vers_set_hist_part() to new call vers_check_limit() at table unlock phase. At that point read_partitions bitmap is already pruned by DML code (see prune_partitions(), find_used_partitions()) so we have to set corresponding bits for working history partition. Also we don't do my_error(ME_WARNING|ME_ERROR_LOG), because at that point it doesn't update warnings number, so command reports 0 warnings (but warning list is still updated). Instead we do push_warning_printf() and sql_print_warning() separately. Under LOCK TABLES external_lock(F_UNLCK) is not executed. There is start_stmt(), but no corresponding "stop_stmt()". So for that mode we call vers_check_limit() directly from close_thread_tables(). Test result has been changed according to new LIMIT and warning printing algorithm. For convenience all LIMIT warnings are marked with "You see warning above ^". TODO MDEV-20345 fixed. Now vers_history_generating() contains fine-grained list of DML-commands that can generate history (and TODO mechanism worked well).
| | * MDEV-25546 LIMIT partitioning does not respect ROLLBACKAleksey Midenkov2022-04-221-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | vers_info->hist_part retained stale value after ROLLBACK. The algorithm in vers_set_hist_part() continued iteration from that value. The simplest solution is to process partitions each time from start for LIMIT in vers_set_hist_part().
* | | Merge branch '10.5' into 10.6Oleksandr Byelkin2022-02-031-11/+20
|\ \ \ | |/ /
| * | Merge branch '10.4' into 10.5Oleksandr Byelkin2022-02-011-11/+20
| |\ \ | | |/
| | * Merge branch '10.2' into 10.3mariadb-10.3.33Oleksandr Byelkin2022-01-291-7/+8
| | |\
| | | * MDEV-25917 create table like fails if source table is partitioned and engine ↵Alexey Botchkov2022-01-251-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is myisam or aria with data directory. Create table like removes data_file_path/index_file_path from the thd->work_partition_info.
| | | * MDEV-17556 Assertion `bitmap_is_set_all(&table->s->all_set)' failedNikita Malyavin2021-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assertion failed in handler::ha_reset upon SELECT under READ UNCOMMITTED from table with index on virtual column. This was the debug-only failure, though the problem is mush wider: * MY_BITMAP is a structure containing my_bitmap_map, the latter is a raw bitmap. * read_set, write_set and vcol_set of TABLE are the pointers to MY_BITMAP * The rest of MY_BITMAPs are stored in TABLE and TABLE_SHARE * The pointers to the stored MY_BITMAPs, like orig_read_set etc, and sometimes all_set and tmp_set, are assigned to the pointers. * Sometimes tmp_use_all_columns is used to substitute the raw bitmap directly with all_set.bitmap * Sometimes even bitmaps are directly modified, like in TABLE::update_virtual_field(): bitmap_clear_all(&tmp_set) is called. The last three bullets in the list, when used together (which is mostly always) make the program flow cumbersome and impossible to follow, notwithstanding the errors they cause, like this MDEV-17556, where tmp_set pointer was assigned to read_set, write_set and vcol_set, then its bitmap was substituted with all_set.bitmap by dbug_tmp_use_all_columns() call, and then bitmap_clear_all(&tmp_set) was applied to all this. To untangle this knot, the rule should be applied: * Never substitute bitmaps! This patch is about this. orig_*, all_set bitmaps are never substituted already. This patch changes the following function prototypes: * tmp_use_all_columns, dbug_tmp_use_all_columns to accept MY_BITMAP** and to return MY_BITMAP * instead of my_bitmap_map* * tmp_restore_column_map, dbug_tmp_restore_column_maps to accept MY_BITMAP* instead of my_bitmap_map* These functions now will substitute read_set/write_set/vcol_set directly, and won't touch underlying bitmaps.
| | * | MDEV-27217 DELETE partition selection doesn't work for history partitionsAleksey Midenkov2022-01-131-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LIMIT history switching requires the number of history partitions to be marked for read: from first to last non-empty plus one empty. The least we can do is to fail with error message if the needed partition was not marked for read. As this is handler interface we require new handler error code to display user-friendly error message. Switching by INTERVAL works out-of-the-box with ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET error.
* | | | Optimize usage of c_ptr(), c_ptr_quick() and String::alloc()Monty2021-05-191-4/+7
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that when one used String::alloc() to allocate a string, the String ensures that there is space for an extra NULL byte in the buffer and if not, reallocates the string. This is a problem with the String::set_int() that calls alloc(21), which forces extra malloc/free calls to happen. - We do not anymore re-allocate String if alloc() is called with the Allocated_length. This reduces number of malloc() allocations, especially one big re-allocation in Protocol::send_result_Set_metadata() for almost every query that produced a result to the connnected client. - Avoid extra mallocs when using LONGLONG_BUFFER_SIZE This can now be done as alloc() doesn't increase buffers if new length is not bigger than old one. - c_ptr() is redesigned to be safer (but a bit longer) than before. - Remove wrong usage of c_ptr_quick() c_ptr_quick() was used in many cases to get the pointer to the used buffer, even when it didn't need to be \0 terminated. In this case ptr() is a better substitute. Another problem with c_ptr_quick() is that it did not guarantee that the string would be \0 terminated. - item_val_str(), an API function not used currently by the server, now always returns a null terminated string (before it didn't always do that). - Ensure that all String allocations uses STRING_PSI_MEMORY_KEY. The old mixed usage of performance keys caused assert's when String buffers where shrunk. - Binary_string::shrink() is simplifed - Fixed bug in String(const char *str, size_t len, CHARSET_INFO *cs) that used Binary_string((char *) str, len) instead of Binary_string(str,len). - Changed argument to String() creations and String.set() functions to use 'const char*' instead of 'char*'. This ensures that Alloced_length is not set, which gives safety against someone trying to change the original string. This also would allow us to use !Alloced_length in c_ptr() if needed. - Changed string_ptr_cmp() to use memcmp() instead of c_ptr() to avoid a possible malloc during string comparision.
* | | Merge branch 'bb-10.4-release' into bb-10.5-releaseSergei Golubchik2021-02-151-2/+2
|\ \ \ | |/ /
| * | MDEV-17556 Assertion `bitmap_is_set_all(&table->s->all_set)' failedNikita Malyavin2021-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assertion failed in handler::ha_reset upon SELECT under READ UNCOMMITTED from table with index on virtual column. This was the debug-only failure, though the problem is mush wider: * MY_BITMAP is a structure containing my_bitmap_map, the latter is a raw bitmap. * read_set, write_set and vcol_set of TABLE are the pointers to MY_BITMAP * The rest of MY_BITMAPs are stored in TABLE and TABLE_SHARE * The pointers to the stored MY_BITMAPs, like orig_read_set etc, and sometimes all_set and tmp_set, are assigned to the pointers. * Sometimes tmp_use_all_columns is used to substitute the raw bitmap directly with all_set.bitmap * Sometimes even bitmaps are directly modified, like in TABLE::update_virtual_field(): bitmap_clear_all(&tmp_set) is called. The last three bullets in the list, when used together (which is mostly always) make the program flow cumbersome and impossible to follow, notwithstanding the errors they cause, like this MDEV-17556, where tmp_set pointer was assigned to read_set, write_set and vcol_set, then its bitmap was substituted with all_set.bitmap by dbug_tmp_use_all_columns() call, and then bitmap_clear_all(&tmp_set) was applied to all this. To untangle this knot, the rule should be applied: * Never substitute bitmaps! This patch is about this. orig_*, all_set bitmaps are never substituted already. This patch changes the following function prototypes: * tmp_use_all_columns, dbug_tmp_use_all_columns to accept MY_BITMAP** and to return MY_BITMAP * instead of my_bitmap_map* * tmp_restore_column_map, dbug_tmp_restore_column_maps to accept MY_BITMAP* instead of my_bitmap_map* These functions now will substitute read_set/write_set/vcol_set directly, and won't touch underlying bitmaps.
* | | Merge 10.4 into 10.5Marko Mäkelä2020-08-011-4/+1
|\ \ \ | |/ /
| * | MDEV-16023 Unfortunate error message WARN_VERS_PART_FULL (partition <name> ↵Nikita Malyavin2020-07-291-1/+0
| | | | | | | | | | | | | | | | | | is full) when rotation time for the last interval passed * remove one case of WARN_VERS_PART_FULL
* | | Merge 10.4 into 10.5Marko Mäkelä2020-06-051-0/+2
|\ \ \ | |/ /
| * | MDEV-22112 Assertion `tab_part_info->part_type == RANGE_PARTITION || ↵Aleksey Midenkov2020-06-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tab_part_info->part_type == LIST_PARTITION' failed in prep_alter_part_table Incorrect syntax for SYSTEM_TIME partition. work_part_info is detected as HASH partition. We cannot add partition of different type neither we cannot reorganize SYSTEM_TIME into/from different type partitioning. The sidefix for version until 10.5 corrects the message: "For LIST partitions each partition must be defined"
* | | MDEV-22155 ALTER add default history partitions name clash on non-default ↵Aleksey Midenkov2020-04-271-9/+4
| | | | | | | | | | | | | | | | | | | | | partitions If any of default names clashes with existing names find next large enough name gap for the requested number of partitions.
* | | MDEV-22153 ALTER add default history partitions makes table inaccessibleAleksey Midenkov2020-04-061-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ADD default history partitions generates wrong partition name, f.ex. p2 instead of p1. Gap in sequence of partition names leads to ha_partition::open_read_partitions() fail on inexistent name. Manual fixing such broken table requires: 1. create empty table by any name (t_empty) with correct number of partitions; 2. stop the server; 3. rename data files (.myd, .myi or .ibd) of broken table to t_empty fixing the partition sequence (#p2 to #p1, #p3 to #p2); 4. start the server; 5. drop the broken table; 6. rename t_empty to correct table name.
* | | MDEV-21743 Split up SUPER privilege to smaller privilegesAlexander Barkov2020-03-101-1/+0
| | |
* | | cleanup: PSI key is *always* the first argumentSergei Golubchik2020-03-101-3/+2
| | |
* | | perfschema memory related instrumentation changesSergei Golubchik2020-03-101-1/+2
| | |
* | | Revert "MDEV-17554 Auto-create new partition for system versioned tables ↵Sergei Golubchik2020-02-271-261/+17
| | | | | | | | | | | | | | | | | | | | | with history partitioned by INTERVAL/LIMIT" This reverts commit 9894751a2a61ef952ac6ac556fd683e53fc150e2. This reverts commit f707c83fff4fa3f5291684e6226542fdb75bbdeb.
* | | Compilation fixAleksey Midenkov2020-02-251-0/+1
| | |
* | | MDEV-17554 Auto-create new partition for system versioned tables with ↵Aleksey Midenkov2020-02-251-17/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | history partitioned by INTERVAL/LIMIT When there are E empty partitions left, auto-create N new empty partitions for SYSTEM_TIME partitioning rotated by INTERVAL/LIMIT and marked by AUTO_INCREMENT keyword. Syntax change: AUTO_INCREMENT keyword (or shorter AUTO may be used instead) after LIMIT/INTERVAL clause. CREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 100000 AUTO_INCREMENT; CREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 WEEK AUTO_INCREMENT; The current revision implements hard-coded values of 1 for E and N. As well as auto-creation threshold MinInterval = 1 hour, MinLimit = 1000. The name for newly added partition will be first chosen as "pX", where X is partition number and "p" is hard-coded name prefix. If this name is already occupied, the X will be incremented until the resulting name will be free to use. ALTER TABLE ADD PARTITION is now always fast. If there some history partition overflow occurs manual ALTER TABLE REBUILD PARTITION is needed.
* | | MDEV-17554 history partitioning cleanupsAleksey Midenkov2019-12-031-92/+15
| | | | | | | | | | | | | | | | | | | | | * Fixed missed warning on condition boundary * REORGANIZE cases * vers_utils.h removed * test cases cleanup
* | | MDEV-19903 Setup default partitions for system versioningAleksey Midenkov2019-11-221-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement syntax like: create table t1 (x int) with system versioning partition by system_time; which will create 1 history partition and 1 current partition. Also it is possible to specify the number of history partitions: create table t1 (x int) with system versioning partition by system_time partitions 5; which will create 4 history partitions (and 1 current partition). Tests: partition.test cases are duplicated where it is appropriate for default partitions. partition_rotation.test cases are replaced by default partitions where possible.
* | | Compilation fix with partitioning off (MDEV-17553)Aleksey Midenkov2019-11-071-95/+96
| | |
* | | MDEV-17553 Enable setting start datetime for interval partitioned history of ↵Aleksey Midenkov2019-11-071-8/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | system versioned tables * Explicit STARTS syntax * SHOW CREATE * Default STARTS rounding depending on INTERVAL type * Warn when STARTS timestamp is later than query time * Fix uninitialized Lex->create_last_non_select_table under mysql_unpack_partition() Default STARTS rounding depending on INTERVAL type If STARTS clause is omitted, default one is assigned with value derived from query timestamp. The rounding is done on STARTS value depending on INTERVAL type: SECOND: no rounding is done; MINUTE: timestamp seconds is set to 0; HOUR: timestamp seconds and minutes are set to 0; DAY, WEEK, MONTH and YEAR: timestamp seconds, minutes and hours are set to 0 (the date of rotation is kept as current date).
* | | Merge 10.4 into 10.5Marko Mäkelä2019-09-061-23/+13
|\ \ \ | |/ /
| * | Compilation fixAleksey Midenkov2019-09-011-4/+1
| | | | | | | | | | | | | | | Caused by: MDEV-18501 Partition pruning doesn't work for historical queries (cleanup)
| * | MDEV-18501 Partition pruning doesn't work for historical queries (refactoring)Aleksey Midenkov2019-09-011-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | SYSTEM_TYPE partitioning: COLUMN properties removed. Partitioning is now pure RANGE based on UNIX_TIMESTAMP(row_end). DECIMAL type is now allowed as RANGE partitioning, we can partition by UNIX_TIMESTAMP() (but not for DATETIME which depends on local timezone of course).
| * | MDEV-18501 Partition pruning doesn't work for historical queries (cleanup)Aleksey Midenkov2019-09-011-8/+1
| | | | | | | | | | | | Cleanup removes useless allocation.
* | | Revert "MDEV-20342 Turn Field::flags from a member to a method"Alexander Barkov2019-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | This reverts commit e86010f909fb6b8c4ffd9d6df92991ac079e67e7. Reverting on Monty's request, as this change makes merging things from 10.5 to 10.2 much harder.
* | | MDEV-20342 Turn Field::flags from a member to a methodAlexander Barkov2019-08-141-1/+1
| | |
* | | Using more of Sql_mode_save. Adding a similar class for THD::abort_on_warnings.Alexander Barkov2019-05-281-5/+1
|/ /
* | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
|\ \ | |/
| * 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