summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-17554 Auto-create new partition for system versioned tables with ↵Aleksey Midenkov2022-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | history partitioned by INTERVAL/LIMIT :: Syntax change :: Keyword AUTO enables history partition auto-creation. Examples: CREATE TABLE t1 (x int) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO; CREATE TABLE t1 (x int) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 MONTH STARTS '2021-01-01 00:00:00' AUTO PARTITIONS 12; CREATE TABLE t1 (x int) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME LIMIT 1000 AUTO; Or with explicit partitions: CREATE TABLE t1 (x int) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO (PARTITION p0 HISTORY, PARTITION pn CURRENT); To disable or enable auto-creation one can use ALTER TABLE by adding or removing AUTO from partitioning specification: CREATE TABLE t1 (x int) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO; # Disables auto-creation: ALTER TABLE t1 PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR; # Enables auto-creation: ALTER TABLE t1 PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO; If the rest of partitioning specification is identical to CREATE TABLE no repartitioning will be done (for details see MDEV-27328). :: Description :: Before executing history-generating DML command (see the list of commands below) add N history partitions, so that N would be sufficient for potentially generated history. N > 1 may be required when history partitions are switched by INTERVAL and current_timestamp is N times further than the interval boundary of the last history partition. If the last history partition equals or exceeds LIMIT records then new history partition is created and selected as the working partition. According to MDEV-28411 partitions cannot be switched (or created) while the command is running. Thus LIMIT does not carry strict limitation and the history partition size must be planned as LIMIT value plus average number of history one DML command can generate. Auto-creation is implemented by synchronous fast_alter_partition_table() call from the thread of the executed DML command before the command itself is run (by the fallback and retry mechanism similar to Discovery feature, see Open_table_context). The name for newly added partitions are generated like default partition names with extension of MDEV-22155 (which avoids name clashes by extending assignment counter to next free-enough gap). These DML commands can trigger auto-creation: DELETE (including multitable DELETE, excluding DELETE HISTORY) UPDATE (including multitable UPDATE) REPLACE (including REPLACE .. SELECT) INSERT .. ON DUPLICATE KEY UPDATE (including INSERT .. SELECT .. ODKU) LOAD DATA .. REPLACE :: Bug fixes :: MDEV-23642 Locking timeout caused by auto-creation affects original DML The reasons for this are: - Do not disrupt main business process (the history is auxiliary service); - Consequences are non-fatal (history is not lost, but comes into wrong partition; fixed by partitioning rebuild); - There is more freedom for application to fail in this case or not: it may read warning info and find corresponding error number. - While non-failing command is easy to handle by an application and fail it, the opposite is hard to handle: there is no automatic actions to fix failed command and retry, DBA intervention is required and until then application is non-functioning. MDEV-23639 Auto-create does not work under LOCK TABLES or inside triggers Don't do tdc_remove_table() for OT_ADD_HISTORY_PARTITION because it is not possible in locked tables mode. LTM_LOCK_TABLES mode (and LTM_PRELOCKED_UNDER_LOCK_TABLES) works out of the box as fast_alter_partition_table() can reopen tables via locked_tables_list. In LTM_PRELOCKED we reopen and relock table manually. :: More fixes :: * some_table_marked_for_reopen flag fix some_table_marked_for_reopen affets only reopen of m_locked_tables. I.e. Locked_tables_list::reopen_tables() reopens only tables from m_locked_tables. * Unused can_recover_from_failed_open() condition Is recover_from_failed_open() can be really used after open_and_process_routine()? :: Reviewed by :: Sergei Golubchik <serg@mariadb.org>
* Merge 10.8 into 10.9Marko Mäkelä2022-04-282-22/+3
|\
| * Merge 10.7 into 10.8Marko Mäkelä2022-04-272-22/+3
| |\
| | * Merge 10.6 into 10.7Marko Mäkelä2022-04-262-22/+3
| | |\
| | | * Merge 10.5 into 10.6Marko Mäkelä2022-04-261-6/+0
| | | |\
| | | | * Cleanup: Remove IF_VALGRINDMarko Mäkelä2022-04-251-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of the compress() wrapper my_compress_buffer() was twofold: silence Valgrind warnings about uninitialized memory access before zlib 1.2.4, and have PERFORMANCE_SCHEMA instrumentation of some zlib related memory allocation. Because of PERFORMANCE_SCHEMA, we cannot trivially replace my_compress_buffer() with compress(). az_open(): Remove a crc32() call. Any CRC of the empty string is 0.
| | | * | MDEV-15250 fixup: Remove MY_GNUC_PREREQMarko Mäkelä2022-04-261-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macro MY_GNUC_PREREQ() was used for testing for some minor GCC 4 versions before GCC 4.8.5, which is the oldest version that supports C++11, which we depend on ever since commit d9613b750c6d975beed0e1d7f0cb1a8dd3ad106b
| | | * | MDEV-15250 UPSERT during ALTER TABLE results in 'Duplicate entry' error for ↵Thirunarayanan Balathandayuthapani2022-04-251-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alter - InnoDB DDL results in `Duplicate entry' if concurrent DML throws duplicate key error. The following scenario explains the problem connection con1: ALTER TABLE t1 FORCE; connection con2: INSERT INTO t1(pk, uk) VALUES (2, 2), (3, 2); In connection con2, InnoDB throws the 'DUPLICATE KEY' error because of unique index. Alter operation will throw the error when applying the concurrent DML log. - Inserting the duplicate key for unique index logs the insert operation for online ALTER TABLE. When insertion fails, transaction does rollback and it leads to logging of delete operation for online ALTER TABLE. While applying the insert log entries, alter operation encounters 'DUPLICATE KEY' error. - To avoid the above fake duplicate scenario, InnoDB should not write any log for online ALTER TABLE before DML transaction commit. - User thread which does DML can apply the online log if InnoDB ran out of online log and index is marked as completed. Set online log error if apply phase encountered any error. It can also clear all other indexes log, marks the newly added indexes as corrupted. - Removed the old online code which was a part of DML operations commit_inplace_alter_table() : Does apply the online log for the last batch of secondary index log and does frees the log for the completed index. trx_t::apply_online_log: Set to true while writing the undo log if the modified table has active DDL trx_t::apply_log(): Apply the DML changes to online DDL tables dict_table_t::is_active_ddl(): Returns true if the table has an active DDL dict_index_t::online_log_make_dummy(): Assign dummy value for clustered index online log to indicate the secondary indexes are being rebuild. dict_index_t::online_log_is_dummy(): Check whether the online log has dummy value ha_innobase_inplace_ctx::log_failure(): Handle the apply log failure for online DDL transaction row_log_mark_other_online_index_abort(): Clear out all other online index log after encountering the error during row_log_apply() row_log_get_error(): Get the error happened during row_log_apply() row_log_online_op(): Does apply the online log if index is completed and ran out of memory. Returns false if apply log fails UndorecApplier: Introduced a class to maintain the undo log record, latched undo buffer page, parse the undo log record, maintain the undo record type, info bits and update vector UndorecApplier::get_old_rec(): Get the correct version of the clustered index record that was modified by the current undo log record UndorecApplier::clear_undo_rec(): Clear the undo log related information after applying the undo log record UndorecApplier::log_update(): Handle the update, delete undo log and apply it on online indexes UndorecApplier::log_insert(): Handle the insert undo log and apply it on online indexes UndorecApplier::is_same(): Check whether the given roll pointer is generated by the current undo log record information trx_t::rollback_low(): Set apply_online_log for the transaction after partially rollbacked transaction has any active DDL prepare_inplace_alter_table_dict(): After allocating the online log, InnoDB does create fulltext common tables. Fulltext index doesn't allow the index to be online. So removed the dead code of online log removal Thanks to Marko Mäkelä for providing the initial prototype and Matthias Leich for testing the issue patiently.
* | | | | MDEV-27911: Implement range notation for json pathRucha Deodhar2022-04-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Range can be thought about in similar manner as wildcard (*) where more than one elements are processed. To implement range notation, extended json parser to parse the 'to' keyword and added JSON_PATH_ARRAY_RANGE for path type. If there is 'to' keyword then use JSON_PATH_ARRAY range for path type along with existing type. This new integer to store the end index of range is n_item_end. When there is 'to' keyword, store the integer in n_item_end else store in n_item.
* | | | | MDEV-22224: Support JSON Path negative indexRucha Deodhar2022-04-131-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch can be viewed as combination of two parts: 1) Enabling '-' in the path so that the parser does not give out a warning. 2) Setting the negative index to a correct value and returning the appropriate value. 1) To enable using the negative index in the path: To make the parser not return warning when negative index is used in path '-' needs to be allowed in json path characters. P_NEG is added to enable this and is made recognizable by setting the 45th index of json_path_chr_map[] to P_NEG (instead of previous P_ETC) because 45 corresponds to '-' in unicode. When the path is being parsed and '-' is encountered, the parser should recognize it as parsing '-' sign, so a new json state PS_NEG is required. When the state is PS_NEG, it means that a negative integer is going to be parsed so set is_negative_index of current step to 1 and n_item is set accordingly when integer is encountered after '-'. Next proceed with parsing rest of the path and get the correct path. Next thing is parsing the json and returning correct value. 2) Setting the negative index to a correct value and returning the value: While parsing json if we encounter array and the path step for the array is a negative index (n_item < 0), then we can count the number of elements in the array and set n_item to correct corresponding value. This is done in json_skip_array_and_count.
* | | | | Merge 10.8 into 10.9Marko Mäkelä2022-04-131-1/+6
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.7 into 10.8Nayuta Yanagisawa2022-04-131-1/+6
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.6 into 10.7Marko Mäkelä2022-04-121-1/+6
| | |\ \ \ | | | |/ /
| | | * | MDEV-10183 implement service_manager_extend_timeout on WindowsVladislav Vaintroub2022-04-111-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | The implementation calls SetServiceStatus() with updated SERVICE_STATUS::dwHint and SERVICE_STATUS::dwCheckpoint
* | | | | Merge 10.8 into 10.9Marko Mäkelä2022-04-061-1/+4
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.7 into 10.8Marko Mäkelä2022-04-061-1/+4
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.6 into 10.7Marko Mäkelä2022-04-061-1/+4
| | |\ \ \ | | | |/ /
| | | * | Merge 10.5 into 10.6Marko Mäkelä2022-04-061-1/+4
| | | |\ \ | | | | |/
| | | | * Merge 10.4 into 10.5Marko Mäkelä2022-04-061-1/+4
| | | | |\
| | | | | * Merge 10.3 into 10.4Marko Mäkelä2022-04-061-1/+4
| | | | | |\
| | | | | | * Merge 10.2 into 10.3Marko Mäkelä2022-04-061-1/+4
| | | | | | |\
| | | | | | | * MDEV-26136: Correct AIX/macOS cast warning (my_time.h)Daniel Black2022-04-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tv_usec is a (suseconds_t) so we cast to it. Prevents the AIX(gcc-10) warning: include/my_time.h: In function 'void my_timeval_trunc(timeval*, uint)': include/my_time.h:249:65: warning: conversion from 'long int' to 'suseconds_t' {aka 'int'} may change value [-Wconversion] 249 | tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); | macOS is: conversion from 'long int' to '__darwin_suseconds_t' {aka 'int'} may change value On Windows suseconds_t isn't defined so we use the existing long return type of my_time_fraction_remainder. Reviewed by Marko Mäkelä Closes: #2079
* | | | | | | | Merge 10.8 into 10.9Marko Mäkelä2022-03-301-17/+1
|\ \ \ \ \ \ \ \ | |/ / / / / / /
| * | | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-03-301-17/+1
| |\ \ \ \ \ \ \ | | |/ / / / / /
| | * | | | | | Merge 10.6 into 10.7Marko Mäkelä2022-03-301-17/+1
| | |\ \ \ \ \ \ | | | |/ / / / /
| | | * | | | | Merge 10.5 into 10.6Marko Mäkelä2022-03-291-17/+1
| | | |\ \ \ \ \ | | | | |/ / / /
| | | | * | | | Merge 10.4 into 10.5Marko Mäkelä2022-03-291-17/+1
| | | | |\ \ \ \ | | | | | |/ / /
| | | | | * | | MDEV-17441 fixup: Remove unused my_atomic long macrosMarko Mäkelä2022-03-241-17/+1
| | | | | | | |
* | | | | | | | MDEV-27743 Remove Lex::charsetAlexander Barkov2022-03-222-1/+10
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch also fixes: MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition MDEV-27853 Wrong data type on column `COLLATE DEFAULT` and table `COLLATE some_non_default_collation` MDEV-28067 Multiple conflicting column COLLATE clauses are not rejected MDEV-28118 Wrong collation of `CAST(.. AS CHAR COLLATE DEFAULT)` MDEV-28119 Wrong column collation on MODIFY + CONVERT
* | | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-03-141-1/+9
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge 10.6 into 10.7Marko Mäkelä2022-03-141-1/+9
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Merge 10.5 into 10.6Marko Mäkelä2022-03-141-1/+9
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | MDEV-24841 Build error with MSAN use-of-uninitialized-value in comp_errMarko Mäkelä2022-03-141-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MemorySanitizer implementation in clang includes some built-in instrumentation (interceptors) for GNU libc. In GNU libc 2.33, the interface to the stat() family of functions was changed. Until the MemorySanitizer interceptors are adjusted, any MSAN code builds will act as if that the stat() family of functions failed to initialize the struct stat. A fix was applied in https://reviews.llvm.org/rG4e1a6c07052b466a2a1cd0c3ff150e4e89a6d87a but it fails to cover the 64-bit variants of the calls. For now, let us work around the MemorySanitizer bug by defining and using the macro MSAN_STAT_WORKAROUND().
* | | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-03-116-10/+12
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Fix clang -Wtypedef-redefinitionMarko Mäkelä2022-03-116-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixup for commit 77c184df7c056da7364e606ac977cc2d3cd826ad
* | | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-02-221-1/+3
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge 10.6 into 10.7Marko Mäkelä2022-02-221-1/+3
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Merge 10.5 into 10.6Marko Mäkelä2022-02-221-1/+3
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Merge 10.4 into 10.5Vlad Lesin2022-02-221-1/+3
| | | |\ \ \ \ | | | | |/ / /
| | | | * | | Merge 10.3 into 10.4Vlad Lesin2022-02-211-1/+3
| | | | |\ \ \ | | | | | |/ /
| | | | | * | MDEV-27730 Add PLUGIN_VAR_DEPRECATED flag to plugin variablesNayuta Yanagisawa2022-02-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sys_var class has the deprecation_substitute member to mark the deprecated variables. As it's set, the server produces warnings when these variables are used. However, the plugin has no means to utilize that functionality. So, the PLUGIN_VAR_DEPRECATED flag is introduced to set the deprecation_substitute with the empty string. A non-empty string can make the warning more informative, but there's no nice way seen to specify it, and not that needed at the moment.
* | | | | | | Merge branch '10.7' into 10.8mariadb-10.8.2Sergei Golubchik2022-02-101-2/+8
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | support lzma < 5.1.3alphaSergei Golubchik2022-02-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | where `lzma_allocator *allocator` isn't declared const
* | | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-02-091-1/+1
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge 10.6 into 10.7Marko Mäkelä2022-02-091-1/+1
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Merge 10.5 into 10.6Marko Mäkelä2022-02-091-1/+1
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Merge branch '10.5' into bb-10.5-releaseOleksandr Byelkin2022-02-091-1/+1
| | | |\ \ \ \
| | | | * | | | Fixes some compiler issues on AIX (Monty2022-02-081-1/+1
| | | | | | | |
* | | | | | | | Merge branch '10.7' into 10.8Oleksandr Byelkin2022-02-0426-27/+89
|\ \ \ \ \ \ \ \ | |/ / / / / / /
| * | | | | | | Merge branch '10.6' into 10.7Oleksandr Byelkin2022-02-0426-26/+88
| |\ \ \ \ \ \ \ | | |/ / / / / /