summaryrefslogtreecommitdiff
path: root/sql-common
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-28910 remove the 5.5.5- version hackSergei Golubchik2023-01-251-2/+3
| | | | | | no longer needed, MySQL replication was fixed meanwhile. client code still can recognize and strip the prefix though.
* MDEV-27009 Add UCA-14.0.0 collationsAlexander Barkov2022-08-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added one neutral and 22 tailored (language specific) collations based on Unicode Collation Algorithm version 14.0.0. Collations were added for Unicode character sets utf8mb3, utf8mb4, ucs2, utf16, utf32. Every tailoring was added with four accent and case sensitivity flag combinations, e.g: * utf8mb4_uca1400_swedish_as_cs * utf8mb4_uca1400_swedish_as_ci * utf8mb4_uca1400_swedish_ai_cs * utf8mb4_uca1400_swedish_ai_ci and their _nopad_ variants: * utf8mb4_uca1400_swedish_nopad_as_cs * utf8mb4_uca1400_swedish_nopad_as_ci * utf8mb4_uca1400_swedish_nopad_ai_cs * utf8mb4_uca1400_swedish_nopad_ai_ci - Introducing a conception of contextually typed named collations: CREATE DATABASE db1 CHARACTER SET utf8mb4; CREATE TABLE db1.t1 (a CHAR(10) COLLATE uca1400_as_ci); The idea is that there is no a need to specify the character set prefix in the new collation names. It's enough to type just the suffix "uca1400_as_ci". The character set is taken from the context. In the above example script the context character set is utf8mb4. So the CREATE TABLE will make a column with the collation utf8mb4_uca1400_as_ci. Short collations names can be used in any parts of the SQL syntax where the COLLATE clause is understood. - New collations are displayed only one time (without character set combinations) by these statements: SELECT * FROM INFORMATION_SCHEMA.COLLATIONS; SHOW COLLATION; For example, all these collations: - utf8mb3_uca1400_swedish_as_ci - utf8mb4_uca1400_swedish_as_ci - ucs2_uca1400_swedish_as_ci - utf16_uca1400_swedish_as_ci - utf32_uca1400_swedish_as_ci have just one entry in INFORMATION_SCHEMA.COLLATIONS and SHOW COLLATION, with COLLATION_NAME equal to "uca1400_swedish_as_ci", which is the suffix without the character set name: SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME LIKE '%uca1400_swedish_as_ci'; +-----------------------+ | COLLATION_NAME | +-----------------------+ | uca1400_swedish_as_ci | +-----------------------+ Note, the behaviour of old collations did not change. Non-unicode collations (e.g. latin1_swedish_ci) and old UCA-4.0.0 collations (e.g. utf8mb4_unicode_ci) are still displayed with the character set prefix, as before. - The structure of the table INFORMATION_SCHEMA.COLLATIONS was changed. The NOT NULL constraint was removed from these columns: - CHARACTER_SET_NAME - ID - IS_DEFAULT and from the corresponding columns in SHOW COLLATION. For example: SELECT COLLATION_NAME, CHARACTER_SET_NAME, ID, IS_DEFAULT FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME LIKE '%uca1400_swedish_as_ci'; +-----------------------+--------------------+------+------------+ | COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | +-----------------------+--------------------+------+------------+ | uca1400_swedish_as_ci | NULL | NULL | NULL | +-----------------------+--------------------+------+------------+ The NULL value in these columns now means that the collation is applicable to multiple character sets. The behavioir of old collations did not change. Make sure your client programs can handle NULL values in these columns. - The structure of the table INFORMATION_SCHEMA.COLLATION_CHARACTER_SET_APPLICABILITY was changed. Three new NOT NULL columns were added: - FULL_COLLATION_NAME - ID - IS_DEFAULT New collations have multiple entries in COLLATION_CHARACTER_SET_APPLICABILITY. The column COLLATION_NAME contains the collation name without the character set prefix. The column FULL_COLLATION_NAME contains the collation name with the character set prefix. Old collations have full collation name in both FULL_COLLATION_NAME and COLLATION_NAME. SELECT COLLATION_NAME, FULL_COLLATION_NAME, CHARACTER_SET_NAME, ID, IS_DEFAULT FROM INFORMATION_SCHEMA.COLLATION_CHARACTER_SET_APPLICABILITY WHERE FULL_COLLATION_NAME RLIKE '^(utf8mb4|latin1).*swedish.*ci$'; +-----------------------------+-------------------------------------+--------------------+------+------------+ | COLLATION_NAME | FULL_COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | +-----------------------------+-------------------------------------+--------------------+------+------------+ | latin1_swedish_ci | latin1_swedish_ci | latin1 | 8 | Yes | | latin1_swedish_nopad_ci | latin1_swedish_nopad_ci | latin1 | 1032 | | | utf8mb4_swedish_ci | utf8mb4_swedish_ci | utf8mb4 | 232 | | | uca1400_swedish_ai_ci | utf8mb4_uca1400_swedish_ai_ci | utf8mb4 | 2368 | | | uca1400_swedish_as_ci | utf8mb4_uca1400_swedish_as_ci | utf8mb4 | 2370 | | | uca1400_swedish_nopad_ai_ci | utf8mb4_uca1400_swedish_nopad_ai_ci | utf8mb4 | 2372 | | | uca1400_swedish_nopad_as_ci | utf8mb4_uca1400_swedish_nopad_as_ci | utf8mb4 | 2374 | | +-----------------------------+-------------------------------------+--------------------+------+------------+ - Other INFORMATION_SCHEMA queries: SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS; SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.PARAMETERS; SELECT TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES; SELECT DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA; SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.ROUTINES; SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.EVENTS; SELECT DATABASE_COLLATION FROM INFORMATION_SCHEMA.EVENTS; SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.ROUTINES; SELECT DATABASE_COLLATION FROM INFORMATION_SCHEMA.ROUTINES; SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.TRIGGERS; SELECT DATABASE_COLLATION FROM INFORMATION_SCHEMA.TRIGGERS; SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.VIEWS; display full collation names, including character sets prefix, for all collations, including new collations. Corresponding SHOW commands also display full collation names in collation related columns: SHOW CREATE TABLE t1; SHOW CREATE DATABASE db1; SHOW TABLE STATUS; SHOW CREATE FUNCTION f1; SHOW CREATE PROCEDURE p1; SHOW CREATE EVENT ev1; SHOW CREATE TRIGGER tr1; SHOW CREATE VIEW; These INFORMATION_SCHEMA queries and SHOW statements may change in the future, to display show collation names.
* Merge branch '10.6' into 10.7Sergei Golubchik2022-05-111-0/+2
|\
| * Merge branch '10.5' into 10.6Sergei Golubchik2022-05-101-0/+2
| |\
| | * Merge branch '10.4' into 10.5Sergei Golubchik2022-05-091-0/+2
| | |\
| | | * MDEV-11853: semisync thread can be killed after sync binlog but before ACK ↵Brandon Nesterenko2022-04-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the sync state Problem: ======== If a primary is shutdown during an active semi-sync connection during the period when the primary is awaiting an ACK, the primary hard kills the active communication thread and does not ensure the transaction was received by a replica. This can lead to an inconsistent replication state. Solution: ======== During shutdown, the primary should wait for an ACK or timeout before hard killing a thread which is awaiting a communication. We extend the `SHUTDOWN WAIT FOR SLAVES` logic to identify and ignore any threads waiting for a semi-sync ACK in phase 1. Then, before stopping the ack receiver thread, the shutdown is delayed until all waiting semi-sync connections receive an ACK or time out. The connections are then killed in phase 2. Notes: 1) There remains an unresolved corner case that affects this patch. MDEV-28141: Slave crashes with Packets out of order when connecting to a shutting down master. Specifically, If a slave is connecting to a master which is actively shutting down, the slave can crash with a "Packets out of order" assertion error. To get around this issue in the MTR tests, the primary will wait a small amount of time before phase 1 killing threads to let the replicas safely stop (if applicable). 2) This patch also fixes MDEV-28114: Semi-sync Master ACK Receiver Thread Can Error on COM_QUIT Reviewed By ============ Andrei Elkin <andrei.elkin@mariadb.com>
* | | | MDEV-19275 Provide SQL service to plugins.Alexey Botchkov2021-10-191-13/+4
|/ / / | | | | | | | | | | | | | | | SQL service added. It provides the limited set of client library functions to be used by plugin.
* | | Change CHARSET_INFO character set and collaction names to LEX_CSTRINGMonty2021-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removed 68 explict strlen() calls from the code. The following renames was done to ensure we don't use the old names when merging code from earlier releases, as using the new variables for print function could result in crashes: - charset->csname renamed to charset->cs_name - charset->name renamed to charset->coll_name Almost everything where mechanical changes except: - Changed to use the new Protocol::store(LEX_CSTRING..) when possible - Changed to use field->store(LEX_CSTRING*, CHARSET_INFO*) when possible - Changed to use String->append(LEX_CSTRING&) when possible Other things: - There where compiler issues with ensuring that all character set names points to the same string: gcc doesn't allow one to use integer constants when defining global structures (constant char * pointers works fine). To get around this, I declared defines for each character set name length.
* | | MDEV-8334: Rename utf8 to utf8mb3Rucha Deodhar2021-05-191-3/+5
| | | | | | | | | | | | | | | | | | This patch changes the main name of 3 byte character set from utf8 to utf8mb3. New old_mode UTF8_IS_UTF8MB3 is added and set TRUE by default, so that utf8 would mean utf8mb3. If not set, utf8 would mean utf8mb4.
* | | Merge 10.5 into 10.6Marko Mäkelä2021-03-261-2/+2
|\ \ \ | |/ /
| * | Fix various spelling errors still found in codeOtto Kekäläinen2021-03-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge 10.5 into 10.6Marko Mäkelä2020-11-021-2/+2
|\ \ \ | |/ /
| * | Merge branch '10.4' into 10.5Sujatha2020-09-291-2/+2
| |\ \ | | |/
| | * Merge branch '10.3' into 10.4Sujatha2020-09-281-2/+2
| | |\
| | | * Merge branch '10.2' into 10.3Sujatha2020-09-281-2/+2
| | | |\
| | | | * UBSAN: Fix a bit shift overflowMarko Mäkelä2020-09-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shifting a 16-bit type by 16 bits is undefined behaviour. The result is at least 32 bits, so let us cast the shift operand to a wider type before shifting.
* | | | | Merge 10.5 into 10.6Marko Mäkelä2020-09-241-24/+162
|\ \ \ \ \ | |/ / / /
| * | | | Part2: MDEV-23568 Improve performance of my_{time|date|datetime}_to_str()Alexander Barkov2020-09-031-36/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As an additional improvement, let's store string representations of the numbers using an array uint16[256] instead of char[512]. This allows to use int2store(), which copies two bytes at a time on x86, instead of copying the two bytes with digits one-by-one. This change gives an additional 7% to 26% query time reduce for: SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30')); SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30.123456')); SELECT BENCHMARK(10*1000*1000,CONCAT(DATE'2001-01-01')); SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30')); SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30.123456')); The total time reduce (part1 + part2) is now between 15% to 38% for these queries.
| * | | | MDEV-23568 Improve performance of my_{time|date|datetime}_to_str()Alexander Barkov2020-08-281-24/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves functions my_xxx_to_str() using the idea introduced in this change in MySQL-8.0: commit 8d10f2fff6bbdea7f436b868ebb5fd811defc68a Author: Knut Anders Hatlen <knut.hatlen@oracle.com> Date: Thu Oct 10 13:55:07 2019 +0200 Bug#30472888: IMPROVE THE PERFORMANCE OF INTEGER HANDLING IN THE TEXT PROTOCOL The new way prints 2 digits at a time and demonstrates a very impressing query time reduce: 10% to 38%, depending on the exact data type and the number of fractional digits: SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30')); SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30.123456')); SELECT BENCHMARK(10*1000*1000,CONCAT(DATE'2001-01-01')); SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30')); SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30.123456')); See MDEV for details on the benchmark results.
* | | | | Merge branch '10.5' into 10.6Oleksandr Byelkin2020-09-021-0/+6
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-19275 Provide SQL service to plugins.Alexey Botchkov2020-08-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Protocol_local fixed so it can be used now. Some Protocol:: methods made virtual so they can adapt. as well as net_ok and net_send_error functions. execute_sql_string function is exported to the plugins. To be changed with the mysql_use_result.
* | | | | MDEV-23238 - remove async client from server code.Vladislav Vaintroub2020-09-012-2109/+5
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | It is already in libmariadb, and server (also that client in server) does not need it. It does not work in embedded either since it relies on non-blocking sockets
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-08-011-0/+2
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-07-311-0/+2
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-07-311-0/+2
| | |\ \ | | | |/
| | | * MDEV-14203: rpl.rpl_extra_col_master_myisam, ↵Sujatha2020-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rpl.rpl_slave_load_tmpdir_not_exist failed in buildbot with a warning Problem: ======= rpl.rpl_slave_load_tmpdir_not_exist 'stmt' w3 [ fail ] Found warnings/errors in server log file! Test ended at 2017-09-27 20:34:55 [Warning] Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them ^ Found warnings in /mnt/buildbot/build/mariadb-10.2.10/mysql-test/var/3/log/mysqld.1.err ok Analysis: ======== When slave tries to connect to master 'get_master_version_and_clock' function is invoked to perform elaborated slave-master handshake. During this process slave server queries master server, to know if it is checksum aware and at the same time master is notified about its CRC-awareness. The master's side instant value of @@global.binlog_checksum is stored in the dump thread's uservar area as well as cached locally to become known in consensus by master and slave. Post hand-shake slave requests master for binlog dump. It sends 'COM_BINLOG_DUMP'. This command is sent to master by 'cli_advanced_command' call. If there is some temporary network failure during this request_dump call, 'end_server' is invoked to close the current connection between master and slave. Upon connection close the dump thread on the master gets terminated and it clears the 'uservar' data it got through master-slave handshake. The 'COM_BINLOG_DUMP' command is sent once again without master-slave handshake. Since the checksum data is not available with new dump thread a warning gets reported. Fix: === Upon network write error donot attempt reconnect, proceed to master-slave handshake. This ensures that master is aware of slave's capability to use checksums.
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-05-051-3/+17
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-05-051-3/+17
| |\ \ \ | | |/ /
| | * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-05-041-3/+17
| | |\ \ | | | |/
| | | * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-05-021-3/+17
| | | |\
| | | | * Merge branch '5.5' into 10.1Oleksandr Byelkin2020-04-301-3/+17
| | | | |\
| | | | | * Bug#30689251 - BACKPORT TO MYSQL-5.6, BUG#29597896 - NULL POINTER ↵Anushree Prakash B2020-04-301-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DEREFERENCE IN LIBMYSQL DESCRIPTION: ============ There can be issues if the packets sent by the server are not proper. Certain checks should be performed at the client side while unpacking fields data. FIX: ==== Check for the appropriate fields data and error out if it is not present. RB: 23601
* | | | | | MDEV-17812 Use MariaDB in error messages instead of MySQLRasmus Johansson2020-04-081-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed wording in error messages from MySQL to MariaDB. In cases where the word server could be used instead it was done. Tests that have these errors recorded were updated.
* | | | | | cleanup: PSI key is *always* the first argumentSergei Golubchik2020-03-101-4/+5
| | | | | |
* | | | | | perfschema memory related instrumentation changesSergei Golubchik2020-03-102-41/+135
| | | | | |
* | | | | | Merge 10.4 into 10.5Marko Mäkelä2020-01-281-1/+4
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-01-211-1/+4
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-01-211-1/+4
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2020-01-201-1/+4
| | | |\ \ \ | | | | |/ /
| | | | * | Merge branch '5.5' into 10.1Oleksandr Byelkin2020-01-191-1/+4
| | | | |\ \ | | | | | |/
| | | | | * Bug#29630767 - USE OF UNINITIALIZED VALUE IN LIBMYSQL (CLIENT.CC FUNCTION ↵mariadb-5.5.67Sergei Golubchik2020-01-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | RUN_PLUGIN_AUTH)
* | | | | | Merge 10.4 into 10.5Marko Mäkelä2019-12-161-1/+1
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-12-091-1/+1
| |\ \ \ \ \ | | |/ / / /
| | * | | | Lintian complains on spelling errorFaustin Lammler2019-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lintian check complains on spelling error: https://salsa.debian.org/mariadb-team/mariadb-10.3/-/jobs/95739
* | | | | | cleanup: don't use my_getopt_is_args_separator()Sergei Golubchik2019-10-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | only my_getopt should use it, because it changes my_getopt's behavior. If one simply wants to skip the separator - don't ask it to be added in the first place
* | | | | | Merge 10.4 into 10.5Marko Mäkelä2019-10-111-8/+5
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.3 into 10.4Marko Mäkelä2019-10-101-8/+5
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.2 into 10.3Marko Mäkelä2019-10-091-8/+5
| | |\ \ \ \ | | | |/ / /
| | | * | | Fix problem with warnings of new compilers.Oleksandr Byelkin2019-10-041-2/+0
| | | | | |
* | | | | | Merge 10.4 into 10.5Marko Mäkelä2019-09-061-1/+1
|\ \ \ \ \ \ | |/ / / / /