summaryrefslogtreecommitdiff
path: root/sql/tztime.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.11 into 11.0Marko Mäkelä2023-02-161-2/+2
|\
| * Merge 10.6 into 10.8Marko Mäkelä2023-02-101-2/+2
| |\
| | * Merge 10.5 into 10.6Marko Mäkelä2023-02-101-2/+2
| | |\
| | | * Merge 10.4 into 10.5Marko Mäkelä2023-02-101-2/+2
| | | |\
| | | | * Apply clang-tidy to remove empty constructors / destructorsVicențiu Ciorbaru2023-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is the result of running run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' . Code style changes have been done on top. The result of this change leads to the following improvements: 1. Binary size reduction. * For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by ~400kb. * A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb. 2. Compiler can better understand the intent of the code, thus it leads to more optimization possibilities. Additionally it enabled detecting unused variables that had an empty default constructor but not marked so explicitly. Particular change required following this patch in sql/opt_range.cc result_keys, an unused template class Bitmap now correctly issues unused variable warnings. Setting Bitmap template class constructor to default allows the compiler to identify that there are no side-effects when instantiating the class. Previously the compiler could not issue the warning as it assumed Bitmap class (being a template) would not be performing a NO-OP for its default constructor. This prevented the "unused variable warning".
* | | | | Set thd->query() for internal (startup) transactionsMonty2023-02-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This helps with debugging as 'Query: ' in DBUG traces will show something useful, for internal transactions, instead of just "".
* | | | | unify client/tool version stringSergei Golubchik2023-01-191-8/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | it should now always be /path/to/exe Ver <tool version> Distrib <server version> for <OS> (<ARCH>) in all tools and clients
* | | | Merge branch '10.7' into 10.8Oleksandr Byelkin2022-10-041-1/+2
|\ \ \ \
| * \ \ \ Merge branch '10.6' into 10.7Oleksandr Byelkin2022-10-041-1/+2
| |\ \ \ \ | | |/ / /
| | * | | MDEV-29347 MariaDB 10.6.8 fails to start when ONLY_FULL_GROUP_BY gets providedSergei Golubchik2022-09-261-1/+2
| | | | |
* | | | | Merge 10.7 into 10.8Marko Mäkelä2022-08-021-7/+16
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.6 into 10.7Marko Mäkelä2022-08-021-7/+16
| |\ \ \ \ | | |/ / /
| | * | | MDEV-28782: modify mariadb-tzinfo-to-sql to set 'wsrep*' variables ↵Daniel Lenski2022-07-291-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | appropriately in cases where Galera is not compiled in In 3b662c6ebd26b54ce534d9e7451cdc31e6c0046c, it was discovered that the values of the 'wsrep_is_on' and 'wsrep_cannot_replicate_tz' variables need to be overridden for embedded builds to pass However, there are other build configurations where these variables also have NULL values. The mariadb-tzinfo-to-sql script (implemented in sql/tztime.cc) can be slightly modified to set its 'wsrep_is_on' and 'wsrep_cannot_replicate_tz' variables more predictably in all such cases, thus allowing the mysql_tzinfo_to_sql_symlink.test test to pass without any special-casing for particular build types. See comments: - https://github.com/MariaDB/server/commit/3b662c6ebd26b54ce534d9e7451cdc31e6c0046c#r78994411 - https://jira.mariadb.org/browse/MDEV-28782?focusedCommentId=230038&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230038 All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
* | | | | Merge 10.7 into 10.8Marko Mäkelä2022-06-211-4/+4
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.6 into 10.7Marko Mäkelä2022-06-211-4/+4
| |\ \ \ \ | | |/ / /
| | * | | MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap modeDaniel Black2022-06-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Work around MDEV-28718 for now, but also optimize the interation of information_schema.SYSTEM_VARIABLES. Add test case to show that tzinfo data into bootstrap is desired functionality. Bug report thanks to Dan Lenski of AWS.
* | | | | Merge 10.7 into 10.8Marko Mäkelä2022-06-091-20/+10
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.6 into 10.7Marko Mäkelä2022-06-091-20/+10
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.5 into 10.6Marko Mäkelä2022-06-091-20/+10
| | |\ \ \ | | | |/ /
| | | * | Merge 10.4 into 10.5Marko Mäkelä2022-06-091-20/+10
| | | |\ \ | | | | |/
| | | | * Merge 10.3 into 10.4Marko Mäkelä2022-06-091-20/+10
| | | | |\
| | | | | * MDEV-25577 mariadb-tzinfo-to-sql generates superfluous warningsDaniel Lewart2022-06-091-20/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zoneinfo directory is littered with non-timezone information files. These frequently contain extensions, not present in real timezone files. Alo leapseconds is frequently there and is not a timezone file.
| | | * | | Merge branch '10.4' into 10.5Sergei Golubchik2022-05-091-3/+3
| | | |\ \ \ | | | | |/ /
| | | | * | Merge branch '10.3' into 10.4Sergei Golubchik2022-05-081-3/+3
| | | | |\ \ | | | | | |/
| | | | | * Merge branch '10.2' into 10.3Oleksandr Byelkin2022-05-031-4/+4
| | | | | |\
| | | | | | * MDEV-28263 mariadb-tzinfo-to-sql binlog fixesDaniel Black2022-04-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --skip-write-binlog message was confusing that it only had an effect if the galera was enabled. There are uses beyond galera so we apply SET SESSION SQL_LOG_BIN=0 as implied by the option without being conditional on the wsrep status. Remove wsrep.mysql_tzinfo_to_sql_symlink{,_skip} tests as they offered no additional coverage beyond main.mysql_tzinfo_to_sql_symlink as no server testing was done. Introduced a variant of the galera.mariadb_tzinfo_to_sql as galera.mysql_tzinfo_to_sql, which does testing using the mysql client rather than directly importing into the server via mysqltest. Update man page and mysql_tzinfo_to_sql to having a --skip-write-binlog option. merge notes: 10.4: - conflicts in tztime.cc can revert to this version of --help text. - tztime.cc - merge execute immediate @prep1, and leave %s%s trunc_tables, lock_tables after that. 10.6: - Need to remove the not_embedded.inc in mysql_tzinfo_to_sql.test and replace it with no_protocol.inc - leave both mysql_tzinfo_to_sql.test and mariadb_tzinfo_to_sql.sql tests. - sql/tztime.cc - keep entirely 10.6 version.
* | | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-04-271-55/+80
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge 10.6 into 10.7Marko Mäkelä2022-04-261-55/+80
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | MDEV-21208: mysql_tzinfo_to_sql does not work in strict modeDaniel Black2022-04-211-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove Warning that occured by doing an ALTER TABLE ... ORDER BY on an InnoDB table. Reviewed by Brandon Nesterenko
| | * | | | | MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog casesDaniel Black2022-04-211-51/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --skip-write-binlog message was confusing that it only had an effect if the galera was enabled. There are uses beyond galera so we apply SET SESSION SQL_LOG_BIN=0 as implied by the option without being conditional on the wsrep status. We also with --skip-write-binlog actually check the session @@WSREP_ON variable rather than the global server variable. Since 10.6, the wsrep_mode could replicate Aria and MyISAM, in which case no change to innodb and back is needed. By removing the conditions, we can use LOCK TABLES in a general case improving the load speed of Aria (MDEV-23326), regardless of the skip-write-binlog flag. The only case where we don't use LOCK TABLES is when we are replicating via Innodb, because wsrep_on=1 and wsrep_mode doesn't contain REPLICATE_ARIA{,MYISAM}. This uses an Innodb transaction instead. When replicating via InnoDB we change the table engine type back to what it was originally. By removing the \d and other syntax that requires parsing by the mariadb client, we can use the generated SQL more generally, like in the embedded server. We also save and restore the SQL_LOG_BIN and WSREP_ON session server variables so this can be included in the same session as other data without taking into changes in state. Remove wsrep.mysql_tzinfo_to_sql_symlink{,_skip} tests as they offered no additional coverage beyond main.mysql_tzinfo_to_sql_symlink (no server testing was done). Add galera.mariadb_tzinfo_to_sql to actually test the replication of tzinfo data through galera. The conditional executable comment around /*M!100602 ... START TRANSACTION .. LOCK TABLES.. */ is so that we can provide tzinfo files (MDEV-27113, MDBF-389) and in the case that a user uses it on a pre-10.6 server version it will still work. Both START TRANSACTION and LOCK TABLES are not supported in prepared statements in MariaDB versions earlier than 10.6.2. Reviewed by Brandon Nesterenko
* | | | | | | Merge branch '10.7' into 10.8Oleksandr Byelkin2022-02-041-48/+83
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge branch '10.6' into 10.7Oleksandr Byelkin2022-02-041-48/+83
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Merge branch '10.5' into 10.6Oleksandr Byelkin2022-02-031-48/+83
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Merge branch '10.4' into 10.5Oleksandr Byelkin2022-02-011-48/+83
| | | |\ \ \ \ | | | | |/ / /
| | | | * | | Merge branch '10.3' into 10.4Oleksandr Byelkin2022-01-301-8/+28
| | | | |\ \ \ | | | | | |/ /
| | | | | * | Merge branch '10.2' into 10.3mariadb-10.3.33Oleksandr Byelkin2022-01-291-9/+29
| | | | | |\ \ | | | | | | |/
| | | | | | * Improve --help and remove not-free warnings for mysql_tzinfo_to_sqlMonty2022-01-201-9/+29
| | | | | | |
| | | | * | | MDEV-23326: Aria significantly slow on timezone intialisationDaniel Black2022-01-121-39/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --skip-write-binary-log added to mysql_tzinfo_to_sql in MDEV-18778 was only effective if galera was enabled on the server. This is because it tied together three concepts under one option: 1. binary logging 2. wsrep replication, and 3. using innodb as a transitional table type. Change 1: small change in help option to reflect this. To solve the performance problem with Aria tables, LOCK TABLES WRITE is used to eliminate the need to fdatasync until the UNLOCK TABLES. If galera isn't enabled, then we also want to use the LOCK TABLE WRITE mechanism. The START TRANSACTION added in MDEV-23440 needed to be moved to before LOCK TABLES otherwise it would cancel their effect. TRUNCATE TABLE statements also need to be before the LOCK TABLES. When changing back from InnoDB to Aria, include the ORDER BY that was originally there in 6aaccbcbf790 and matching the final ALTER TABLE in the timezonedir branch. Running: mariadb-tzinfo-to-sql --skip-write-binlog /usr/share/zoneinfo now generates 16 Aria_transaction_log_syncs from 7053.
* | | | | | | MDEV-27393 Timezone tables cannot have descending indexesSergei Golubchik2022-01-261-1/+5
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | replace the assert with an if(). asserts should not be used on the input (even without DESC indexes the table could've been corrupted)
* | | | | | MDEV-26221: DYNAMIC_ARRAY use size_t for sizesEric Herman2021-10-191-1/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://jira.mariadb.org/browse/MDEV-26221 my_sys DYNAMIC_ARRAY and DYNAMIC_STRING inconsistancy The DYNAMIC_STRING uses size_t for sizes, but DYNAMIC_ARRAY used uint. This patch adjusts DYNAMIC_ARRAY to use size_t like DYNAMIC_STRING. As the MY_DIR member number_of_files is copied from a DYNAMIC_ARRAY, this is changed to be size_t. As MY_TMPDIR members 'cur' and 'max' are copied from a DYNAMIC_ARRAY, these are also changed to be size_t. The lists of plugins and stored procedures use DYNAMIC_ARRAY, but their APIs assume a size of 'uint'; these are unchanged.
* | | | | Reduce usage of strlen()Monty2021-05-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: - To detect automatic strlen() I removed the methods in String that uses 'const char *' without a length: - String::append(const char*) - Binary_string(const char *str) - String(const char *str, CHARSET_INFO *cs) - append_for_single_quote(const char *) All usage of append(const char*) is changed to either use String::append(char), String::append(const char*, size_t length) or String::append(LEX_CSTRING) - Added STRING_WITH_LEN() around constant string arguments to String::append() - Added overflow argument to escape_string_for_mysql() and escape_quotes_for_mysql() instead of returning (size_t) -1 on overflow. This was needed as most usage of the above functions never tested the result for -1 and would have given wrong results or crashes in case of overflows. - Added Item_func_or_sum::func_name_cstring(), which returns LEX_CSTRING. Changed all Item_func::func_name()'s to func_name_cstring()'s. The old Item_func_or_sum::func_name() is now an inline function that returns func_name_cstring().str. - Changed Item::mode_name() and Item::func_name_ext() to return LEX_CSTRING. - Changed for some functions the name argument from const char * to to const LEX_CSTRING &: - Item::Item_func_fix_attributes() - Item::check_type_...() - Type_std_attributes::agg_item_collations() - Type_std_attributes::agg_item_set_converter() - Type_std_attributes::agg_arg_charsets...() - Type_handler_hybrid_field_type::aggregate_for_result() - Type_handler_geometry::check_type_geom_or_binary() - Type_handler::Item_func_or_sum_illegal_param() - Predicant_to_list_comparator::add_value_skip_null() - Predicant_to_list_comparator::add_value() - cmp_item_row::prepare_comparators() - cmp_item_row::aggregate_row_elements_for_comparison() - Cursor_ref::print_func() - Removes String_space() as it was only used in one cases and that could be simplified to not use String_space(), thanks to the fixed my_vsnprintf(). - Added some const LEX_CSTRING's for common strings: - NULL_clex_str, DATA_clex_str, INDEX_clex_str. - Changed primary_key_name to a LEX_CSTRING - Renamed String::set_quick() to String::set_buffer_if_not_allocated() to clarify what the function really does. - Rename of protocol function: bool store(const char *from, CHARSET_INFO *cs) to bool store_string_or_null(const char *from, CHARSET_INFO *cs). This was done to both clarify the difference between this 'store' function and also to make it easier to find unoptimal usage of store() calls. - Added Protocol::store(const LEX_CSTRING*, CHARSET_INFO*) - Changed some 'const char*' arrays to instead be of type LEX_CSTRING. - class Item_func_units now used LEX_CSTRING for name. Other things: - Fixed a bug in mysql.cc:construct_prompt() where a wrong escape character in the prompt would cause some part of the prompt to be duplicated. - Fixed a lot of instances where the length of the argument to append is known or easily obtain but was not used. - Removed some not needed 'virtual' definition for functions that was inherited from the parent. I added override to these. - Fixed Ordered_key::print() to preallocate needed buffer. Old code could case memory overruns. - Simplified some loops when adding char * to a String with delimiters.
* | | | | tztime_to_sql: quote `Offset` fieldNikita Malyavin2021-05-121-1/+1
|/ / / /
* | | | Fix various spelling errors still found in codeOtto Kekäläinen2021-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reseting -> Resetting Unknow -> Unknown capabilites -> capabilities choosen -> chosen direcory -> directory informations -> information openned -> opened refered -> referred to access -> one to access missmatch -> mismatch succesfully -> successfully dont -> don't
* | | | Added 'const' to arguments in get_one_option and find_typeset()Monty2021-02-081-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One should not change the program arguments! This change also reduces warnings from the icc compiler. Almost all changes are just syntax changes (adding const to 'get_one_option function' declarations). Other changes: - Added a few cast of 'argument' from 'const char*' to 'char *'. This was mainly in calls to 'external' functions we don't have control of. - Ensure that all reset of 'password command line argument' are similar. (In almost all cases it was just adding a comment and a cast) - In mysqlbinlog.cc and mysqld.cc there was a few cases that changed the command line argument. These places where changed to instead allocate the option in a MEM_ROOT to avoid changing the argument. Some of this code was changed to ensure that different programs did parsing the same way. Added a test case for the changes in mysqlbinlog.cc - Changed a few variables that took their value from command line options from 'char *' to 'const char *'.
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-08-201-0/+3
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-08-201-0/+3
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-08-201-0/+3
| | |\ \ | | | |/
| | | * Merge 10.1 into 10.2Marko Mäkelä2020-08-201-0/+3
| | | |\
| | | | * MDEV-23440: mysql_tzinfo_to_sql to use transactionsDaniel Black2020-08-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since MDEV-18778, timezone tables get changed to innodb to allow them to be replicated to other galera nodes. Even without galera, timezone tables could be declared innodb. With the standalone innodb tables, the mysql_tzinfo_to_sql takes approximately 27 seconds. With the transactions enabled in this patch, 1.2 seconds is the approximate load time. While explicit checks for the engine of the time zone tables could be done, or checks against !opt_skip_write_binlog, non-transactional storage engines will just ignore the transactional state without even a warning so its safe to enact globally. Leap seconds are pretty much ignored as they are a single insert statement and have gone out of favour as they have caused MariaDB stalls in the past.
* | | | | Merge 10.4 into 10.5Marko Mäkelä2020-08-101-9/+10
|\ \ \ \ \ | |/ / / /