Console View
|
Categories: connectors experimental galera main |
|
| connectors | experimental | galera | main | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alexander Barkov
bar@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41246 "Illegal mix of collations" on the mysql.user view This SQL script failed: SET NAMES latin1 COLLATE latin1_swedish_ci; CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1; SET NAMES big5 COLLATE big5_chinese_ci; SELECT * FROM v1 WHERE c1='y'; with the following error: ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '=' Note, latin1_swedish_ci and big5_chinese_ci are used here as examples. The error also happened with different collation combinations. Fix main idea: If two collations have equal comparison rules (known as "tailoring") on a given character repertoire, like latin1_swedish_ci and big5_chinese_ci on ASCII letters, then the "Illegal mix of collation" error can be avoided in a comparison operator. We can choose any of the sides as the operation effective collation - the result will be equal. This optimization is not applied when both sides have an explicit COLLATE clause. Two explicit COLLATE clauses in one comparison is already illegal when the character sets are the same, so for consistency it stays illegal when the character sets differ too. Most important details: - Splitting enum_repertoire_t into smaller subsets, for better repertoire granularity. A variable holding a repertoire value can now have multiple MY_REPERTOIRE_XXX flags set. This patch implements detecting tailoring equality on this repertoires: * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9]. * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore * MY_REPERTOIRE_ASCII - the entire range U+0000..U+007F - Adding a new virtual function "tailoring" in my_collation_handler_st It returns the tailoring on the given repertoire for the given collation. If cs1->cset->tailoring(cs1, some_repertoire) returns {0,0}, it means illegal mix optimization cannot be used for this collation on the given repertoire. If these calls: tr1= cs1->cset->tailoring(cs1, some_repertoire); tr2= cs2->cset->tailoring(cs2, some_repertoire); return both non-NULL results and tr1.ptr==tr2.ptr, then these collations are equal on the given repertoire and are mutually replaceable for a comparison operator, so "Illegal mix of collations" can be avoided. - Adding a new method DTCollation::aggregate_by_tailoring(). - Adding a new flag MY_COLL_ALLOW_BY_TAILORING. It indicates to DTCollation::aggregate() that the illegal mix optimization by repertoire can be used in the given context. MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_TAILORING. Note, only comparison operators pass this flag. Functions returning a string result do not pass this flag, because in operations like CONCAT(a,b) we still need to evaluate precisely the collation of the result - we cannot just choose a collation of one of the sides (even if they are compatible on the given repertoire). - As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits rather than a single bit, the way how to detect "is only ASCII" repertoires has changed in the code. For example: // repertoire *IS* ascii if (repertoire == MY_REPERTOIRE_ASCII) has changed in multiple places in the code to // repertoire *HAS* only ascii characters if (!(repertoire & ~MY_REPERTOIRE_ASCII)) - New flags were added for CHARSET_INFO::state * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has no irregularities on the ASCII repertoire. * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has no irregularities on the IDENT repertoire (but can have irregularities say on punctuation). * MY_CS_ASCII_STD_UCA - for UCA collations. It means that a UCA collation does not reorder ASCII letters. - strings/conf_to_src.c was modified to detect and print MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags. - strings/ctype-extra.c was regenerated with new flags. - Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/. They display a tailoring by collation name and repertoire as returned by: cs->cset->tailoring(cs, some_repertoire) A dynamically linked plugin function collation_tailoring() was added for the purpose of these tests. - Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test They display two-dimensional charts showing which collations are compatible on which repertoires. - Adding a number of MTR tests in the form of the originally reported script for various collations: SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...'; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ParadoxV5
paradox.ver5@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-38849 slave_connections_needed_for_purge prevents independent machine from purging binary logs `@@slave_connections_needed_for_purge`’s default of `1` ensures binary log availability on replication masters, but is not a sensible default suitable for all scenarios, especially for long-term slave servers and standalone (not in a replication setup) servers. The outcome was that standalone server users were confused why automatic binlog purging does not work. This commit changes this default to `0`, which is suitable for both standalone and (when backed by prompt failure recovery) replication setups. `0` also more closely matches the behaviour before MDEV-31404, which added this variable, out of the box. This commit also adds a one-time replication warning when registering a slave, but `@@slave_connections_needed_for_purge` is left unchanged. Rather than enforcing a defence with an unsensible default, this reminder will bring awareness of the risk of automatic binlog purging. This commit also cleans up Galera and MTR workarounds to the introduction of the `@@slave_connections_needed_for_purge=1` default. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Daniel Black
daniel@mariadb.org |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41156: ASAN use-after-poison in JSON_CONTAINS_PATH The json_depth_array as allocated for 32 elements but accessed it as though there wasn't a limit. Called mem_root_dynamic_array_resize_and_get_val to ensure that the number of elements was presented, and error JE_EOS (out of space) if allocation exceeded and return its pointer. With the array resizing called early mem_root_dynamic_array_resize_and_set_val isn't required. Removed unused 'value' variable, as value_ptr was always valid. Reported by: David Korczynski of Ada Logics |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
DerZc
34330257+DerZc@users.noreply.github.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-40689 Wrong result: BIT_AND/BIT_OR/BIT_XOR in WINDOW functions over a frame containing NULL BIT_AND, BIT_OR, and BIT_XOR window functions can return incorrect values as a sliding frame moves past NULL input rows. Adding a NULL argument leaves the bit-aggregate state unchanged, but removing that row unconditionally calls remove_as_window() with val_int()'s value. The removal path therefore changes state for a row that never contributed to the aggregate. Evaluate the departing window argument once and retain its unsigned value. Call remove_as_window() only when the evaluated argument is non-NULL. Leave the existing incremental window algorithm and non-window aggregation path in place. The regression checks all three bit aggregates over ROWS BETWEEN 1 PRECEDING AND CURRENT ROW with interleaved NULL and non-NULL values, including removal of a real zero and restoration of the neutral values after the frame becomes all-NULL. Bug report: https://jira.mariadb.org/browse/MDEV-40689 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Khaled Riyad
khaled57.dev@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-38004 Double free on re-execution of prepared aggregate function Between two executions of a prepared statement, Item_sp::cleanup() freed the stored function's memory root but left the arena's free list pointing into it. That list is filled when the function call returns and the active arena is restored. On the next execution Item_sum_sp::clear() walked the stale list and destroyed already freed items. Free the items before the memory they live in. The sequence is now in Item_sp::free_call_ctx(), so the three places that repeat it cannot drift apart again. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Aleksey Midenkov
midenok@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-40462 Move innodb.innodb-virtual-columns-debug into gcol.innodb_virtual_debug innodb.innodb-virtual-columns-debug contained only the MDEV-17005 test case. It is about InnoDB virtual column templates, so it belongs with the other InnoDB virtual column debug tests in gcol.innodb_virtual_debug. Rationale Adding a separate test file for every single bugfix tends to grow the number of MTR tests by tens of thousands (as there are already 40k MDEV tickets). Each test file carries a fixed overhead that does not depend on its size: before and after every test MTR runs check-testcase to compare the server state, checks the error log for warnings, and may restart the server when the options differ from the previous test. For tiny test files this overhead dominates the time of the test itself, so the total time of MTR runs on buildbot and in local testing grows considerably. Besides that, every test is at least two files (.test and .result, often also .opt or .combinations). Tens of thousands of extra small files bloat the test directories, which slows down MTR test collection and any filesystem traversal of the source tree, and they enlarge the git index and tree objects, which makes git status, checkout, clone and merges between branches slower. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Dave Gosselin
dave.gosselin@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41211 Remove unused index_read_idx() from both Federated engines ha_federated::index_read_idx() and ha_federatedx::index_read_idx() have no callers and do not override a handler method. Remove them, and remove the sentence in the comment on each index_read() that says index_read() calls it. Comments that describe index_read_idx() now name index_read() or index_read_idx_map(), whichever does that read. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
KhaledR57
khaled57.dev@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-32383 Server crashes in Item_func_match::init_search on 2nd execution of PS Item_func_match::master points at an equal MATCH item that owns the shared ft_handler. setup_ftfuncs() sets it only when it is still unset, and cleanup() never reset it. A mergeable view is merged once. On re-execution mysql_derived_prepare() returns early because TABLE_LIST::merged is set, so the view's own MATCH item is never re-fixed and keeps the NULL table left by cleanup(). init_ftfuncs() skips unfixed items in ftfunc_list, but init_search() follows master without that check and dereferenced the NULL table. Reset master in cleanup(), after the ft_handler ownership check that reads it, so the link is rebuilt from scratch on every execution. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alexander Barkov
bar@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41246 "Illegal mix of collations" on the mysql.user view This SQL script failed: SET NAMES latin1 COLLATE latin1_swedish_ci; CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1; SET NAMES big5 COLLATE big5_chinese_ci; SELECT * FROM v1 WHERE c1='y'; with the following error: ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '=' Note, latin1_swedish_ci and big5_chinese_ci are used here as examples. The error also happened with different collation combinations. Fix main idea: If two collations have equal comparison rules (known as "tailoring") on a given character repertoire, like latin1_swedish_ci and big5_chinese_ci on ASCII letters, then the "Illegal mix of collations" error can be avoided in a comparison operator. We can choose any of the sides as the operation effective collation - the result will be equal. This optimization is not applied when at least one side has an explicit COLLATE clause. Two explicit COLLATE clauses in one comparison are already illegal when the character sets are the same, so for consistency this stays illegal when the character sets differ too. Most important details: - Splitting enum_repertoire_t into smaller subsets, for better repertoire granularity. A variable holding a repertoire value can now have multiple MY_REPERTOIRE_XXX flags set. This patch implements detecting tailoring equality on these repertoires: * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9]. * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore * MY_REPERTOIRE_ASCII - the entire range U+0000..U+007F - Adding a new virtual function "tailoring" in my_collation_handler_st. It returns the tailoring on the given repertoire for the given collation. If cs1->coll->tailoring(cs1, some_repertoire) returns {0,0}, it means the illegal mix optimization cannot be used for this collation on the given repertoire. If these calls: tr1= cs1->coll->tailoring(cs1, some_repertoire); tr2= cs2->coll->tailoring(cs2, some_repertoire); return both non-NULL results and tr1.str==tr2.str, then these collations are equal on the given repertoire and are mutually replaceable for a comparison operator, so "Illegal mix of collations" can be avoided. - Adding a new method DTCollation::aggregate_by_tailoring(). Like the other successful branches of DTCollation::aggregate(), it makes the resulting repertoire cover both sides. - Adding a new flag MY_COLL_ALLOW_BY_TAILORING. It indicates to DTCollation::aggregate() that the illegal mix optimization by repertoire can be used in the given context. MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_TAILORING. Note, only comparison operators pass this flag. Functions returning a string result do not pass this flag, because in operations like CONCAT(a,b) we still need to evaluate precisely the collation of the result - we cannot just choose a collation of one of the sides (even if they are compatible on the given repertoire). This also applies to ExtractValue() and UpdateXML(), which now aggregate their arguments without this flag. - As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits rather than a single bit, the way to detect "is only ASCII" repertoires has changed in the code. For example: // repertoire *IS* ascii if (repertoire == MY_REPERTOIRE_ASCII) has changed in multiple places in the code to // repertoire *HAS* only ascii characters if (!(repertoire & ~MY_REPERTOIRE_ASCII)) - Repertoire of some expressions was adjusted to the new meaning: * Item_null now has MY_REPERTOIRE_NONE (was ASCII). * MY_LOCALE::repertoire() now returns MY_REPERTOIRE_ALL (was EXTENDED). * Lex_string_with_metadata_st::repertoire(cs) now scans the string contents to detect the actual repertoire. * HEX() has a narrower repertoire. * QUOTE, MAKE_SET, EXPORT_SET, LPAD, RPAD and GROUP_CONCAT add the repertoire of the extra characters they put into the result (quotes, separators, padding). - The tis620 collations now set CHARSET_INFO::tab_to_uni (was NULL), so my_charset_is_ascii_based() is true for tis620. This changes the result of subselect_extra_no_semijoin from an error to success. - New flags were added for CHARSET_INFO::state * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has no irregularities on the ASCII repertoire. * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has no irregularities on the IDENT repertoire (but can have irregularities say on punctuation). * MY_CS_ASCII_STD_UCA - for UCA collations. It means that a UCA collation does not reorder ASCII characters. - strings/conf_to_src.c was modified to detect and print MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags. - strings/ctype-extra.c was regenerated with new flags. - Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/. They display a tailoring by collation name and repertoire as returned by: cs->coll->tailoring(cs, some_repertoire) A dynamically linked plugin function collation_tailoring() was added for the purpose of these tests. - Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test They display two-dimensional charts showing which collations are compatible on which repertoires. - Adding a number of MTR tests in the form of the originally reported script for various collations: SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...'; - Adding tests to ctype_cp932.test checking that ExtractValue() and UpdateXML() still raise "Illegal mix of collations". |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Khaled Riyad
khaled57.dev@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-38861 heap-use-after-free in Prepared_statement::execute() DROP PROCEDURE and CREATE OR REPLACE PROCEDURE executed from inside the routine itself removed it from the SP cache. sp_head::destroy() then freed the memory root that the running sp_head, its LEX and its instructions live in, and the caller kept using them. Skip the removal while the routine is being executed. sp_cache_invalidate() above has already bumped the cache version, so the stale entry is removed by the next lookup, after IS_INVOKED has been cleared. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Aleksey Midenkov
midenok@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-38758 vcol.vcol_partition_innodb fails on buildbot TABLE_ROWS in INFORMATION_SCHEMA.PARTITIONS for InnoDB is dict_table_t::stat_n_rows. Each INSERT puts the record into the clustered index and only afterwards increments stat_n_rows without any latch. The second INSERT into a fresh partition schedules a background persistent stats recalc, which is not throttled because stats_last_recalc is still 0. If the recalc scans the leaf page after the next INSERT has added its record but before that INSERT increments stat_n_rows, the recalc stores the exact count and the increment then adds one more, so p2 shows 4 rows instead of 3. The fix disables innodb_stats_auto_recalc for the duration of inc/vcol_partition.inc in the InnoDB variant of the test, so stat_n_rows is maintained only by the per-row increments and is exact. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Dave Gosselin
dave.gosselin@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41303: rand() in a semi-join subquery is checked on outer rows Do not merge a subquery into its parent as a semi-join when it has the UNCACHEABLE_RAND flag, which RAND() and ROWNUM set. Derived tables already follow this rule. ROWNUM sets the same flag, so this patch replaces the check for ROWNUM with a check for UNCACHEABLE_RAND. Previously, converting an IN subquery to a semi-join moved its WHERE into the parent WHERE. A condition there such as rand(1) < 0.09 doesn't rely on any columns, so it is attached to the last table of the join order that is outside any materialized semi-join. With SJ-Materialization it was checked once for each outer row instead of once for each row of the subquery, and the query returned a wrong count. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ParadoxV5
paradox.ver5@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-4632 multi_source.status_vars test fails sporadically in buildbot `Slave_received_heartbeats`’s test for independence between connections relied on timing with seconds-level precision, which is not consistent on a loaded CI. To avoid reliance on timing accuracy, this commit changes the test strategy to instead measure a live result and use that to show the independence. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Vladislav Vaintroub
vvaintroub@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-39533 Resolve reparse points and enforce MY_NOSYMLINKS on Windows On Windows, my_realpath() only called GetFullPathName(), does not resolve symlinks, junctions or mount points, unlike POSIX realpath(). At the same time, my_open() and my_delete() ignored MY_NOSYMLINKS entirely, so the symlink-attack protection used for MyISAM/Aria's DATA DIRECTORY/INDEX DIRECTORY (mi_open()/ma_open(), my_handler_delete_with_symlink()) was silently absent on Windows. Fix my_realpath() to actually resolve reparse points: open the path with CreateFile(), which follows them, and read back the handle's fully resolved path with GetFinalPathNameByHandle(). As a result, a missing path now correctly returns 1/ENOENT on Windows too, matching Linux's realpath()-based behavior, instead of always returning 0. Make my_open() and my_delete() honor MY_NOSYMLINKS on Windows. Windows has no per-path-component O_NOFOLLOW equivalent, so instead this mirrors the HAVE_REALPATH branch of the POSIX NOSYMLINK_FUNCTION_BODY macro: the caller-supplied name (expected to already be my_realpath()-resolved) is compared against the actually opened handle's resolved path, and rejected with ENOTDIR -- the same errno POSIX uses for this exact "not already canonical" condition -- on a mismatch, whether caused by a TOCTOU symlink swap or by the name never having been fully resolved to begin with. Known limitation: GetFinalPathNameByHandle(FILE_NAME_NORMALIZED), used by both my_realpath() and MY_NOSYMLINKS verification, can fail on some SMB shares (an intermediate directory denying list/read access while still allowing traverse). When that happens, both fall back to the weaker FILE_NAME_OPENED query: my_realpath() still succeeds, but MY_NOSYMLINKS verification is weaker, since FILE_NAME_OPENED may not fully resolve reparse points. A one-time warning naming the affected path is raised the first time this happens. As part of enforcing MY_NOSYMLINKS for my_delete(), my_win_unlink() (formerly in my_delete.c) is rewritten and moved to my_winfile.cc It opens file once, and verifies no symlinks, before removing it. Co-Authored-By: Claude Sonnet 5 <[email protected]> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Dave Gosselin
dave.gosselin@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41211 Federated multi-table DELETE keeps a const table row A multi-table DELETE on a FEDERATED or FederatedX table went wrong when a primary key lookup made the target a const table. The optimizer reads a const table's row through index_read_idx_map(), whose default implementation ends the index scan and frees the result set. The server asks for the row's position later, during execution, so the saved position was empty. FederatedX skipped the row and FEDERATED crashed in rnd_pos(). Both engines now override index_read_idx_map() so that the lookup leaves its result set open, as index_read() does. position() then records a valid position, and the result set is freed at the end of the statement. FEDERATED's reset() now also clears stored_result, which otherwise pointed at a freed result set and was freed again when the table was closed. Tests include a multitable UPDATE with a const target, which crashed both engines before the fix. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Aleksey Midenkov
midenok@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-40462 innodb.innodb-virtual-columns-debug failed in buildbot with wrong result The test sporadically fails because DELETE does not reach the ib_open_after_dict_open sync point: SET debug_sync= "now WAIT_FOR delete_open"; +Warnings: +Warning 1639 debug sync point wait timed out SELECT a FROM t1; a -NULL -NULL The sync point is in ha_innobase::open(), which is called only when a new TABLE is created from the share. After ALTER TABLE ... ALGORITHM=COPY no TABLE for t1 is cached, but t1 has indexed virtual columns, so the purge thread opens it via open_purge_table() and on close_thread_tables() leaves the TABLE in the table cache. If that happens before DELETE, the DELETE reuses the cached TABLE, does not call ha_innobase::open() and completes without signalling delete_open. The fix waits for purge with innodb_max_purge_lag_wait=0 and then does FLUSH TABLES t1 before arming the sync point, so DELETE always opens a new TABLE. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
sjaakola
seppo.jaakola@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41385 wsrep_sync_wait has no effect after COM_CHANGE_USER Also reported as: https://github.com/mariadb-corporation/galera/issues/613. THD::cleanup() cleared THD::wsrep_client_thread. Besides connection close, THD::cleanup() is also called from THD::change_user() when handling COM_CHANGE_USER and COM_RESET_CONNECTION. THD::init() does not set the flag back, and the only place that sets it is thd_prepare_connection(). After either command the session was no longer treated as a wsrep client connection: WSREP_CLIENT() returned false for the rest of the session. As a result wsrep_sync_wait was silently ignored, so causal reads could return stale data. Such connections were also skipped by wsrep_close_client_connections() and wsrep_wait_committing_connections_close(). Connection pools issue COM_RESET_CONNECTION whenever a connection is reused, so in practice most pooled sessions were affected. Fix by moving the reset of wsrep_client_thread from THD::cleanup() to end_connection(), after wsrep_close(). The galera.galera_change_user test is extended to do a causal read on a fresh connection, after COM_CHANGE_USER and after COM_RESET_CONNECTION. Each read must increase the provider's wsrep_causal_reads status counter. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alexander Barkov
bar@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41246 "Illegal mix of collations" on the mysql.user view This SQL script failed: SET NAMES latin1 COLLATE latin1_swedish_ci; CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1; SET NAMES big5 COLLATE big5_chinese_ci; SELECT * FROM v1 WHERE c1='y'; with the following error: ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '=' Note, latin1_swedish_ci and big5_chinese_ci are used here as examples. The error also happened with different collation combinations. Fix main idea: If two collations have equal comparison rules (known as "tailoring") on a given character repertoire, like latin1_swedish_ci and big5_chinese_ci on ASCII letters, then the "Illegal mix of collation" error can be avoided in a comparison operator. We can choose any of the sides as the operation effective collation - the result will be equal. This optimization is not applied when both sides have an explicit COLLATE clause. Two explicit COLLATE clauses in one comparison is already illegal when the character sets are the same, so for consistency it stays illegal when the character sets differ too. Most important details: - Splitting enum_repertoire_t into smaller subsets, for better repertoire granularity. A variable holding a repertoire value can now have multiple MY_REPEROIRE_XXX flags set. This patch implements detecting tailoring equality on this reperoires: * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9]. * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore * MY_REPERTOIRE_ASCII - the entire range U+0000..U+007F - Adding a new virtual function "tailoring" in my_collation_handler_st It returns the tailoring on the given repertoire for the given collation. If cs1->cset->tailoring(cs1, some_repertoire) returns {0,0}, it means illegal mix optimization cannot be used for this collation on the given repertoire. If these calls: tr1= cs1->cset->tailoring(cs1, some_repertoire); tr2= cs2->cset->tailoring(cs2, some_repertoire); return both non-NULL results and tr1.ptr==tr2.ptr, then these collations are equal on the given repertoire and are mutually replaceable for a comparison operator, so "Illegal mix of collations" can be avoided. - Adding a new method DTCollation::aggregate_by_tailoring(). - Adding a new flag MY_COLL_ALLOW_BY_TAILORING. It indicates to DTCollation::aggregate() that the illegal mix optimization by repertoire can be used in the given context. MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_TAILORING. Note, only comparison operators pass this flag. Functions returning a string result do not pass this flag, because in operations like CONCAT(a,b) we still need to evaluate precisely the collation of the result - we cannot just choose a collation of one of the sides (even if they are compatible on the given repertoire). - As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits rather than a single bit, the way how to detect "is only ASCII" repertoires has changed in the code. For example: // repertoire *IS* ascii if (repertoire == MY_REPERTOIRE_ASCII) has changed in multiple places in the code to // repertoire *HAS* only ascii characters if (!(repertoire & ~MY_REPERTOIRE_ASCII)) - New flags were added int for CHARSET_INFO::state * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation does not has no irregularities on the ASCII range. * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has not irregularities on the IDENT subrange only (but can have irregularities say on punctuation). * MY_CS_ASCII_STD_UCA - for UCA collations. It means that a UCA collation does not reorder ASCII letters. - strings/conf_to_src.c was modified to detect and print MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags. - strings/ctype-extra.c was regenerated with new flags. - Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/. They display a tailoring by collation name and repertoire as returned by: cs->cset->tailoring(cs, some_repertoire) A dynamically linked plugin function collation_tailoring() was added for the purpose of these tests. - Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test They display two-dimensional charts showing which collations are compatible on which repertoires. - Adding a number of MTR tests in the form of the originally reported stript for various collations: SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...'; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ParadoxV5
paradox.ver5@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-4632 multi_source.status_vars test fails sporadically in buildbot `Slave_received_heartbeats`’s test for independence between connections relied on timing with second-level precision, which is inconsistent on a loaded CI. To avoid relying on timing accuracy, this commit changes the test strategy to measure a live result and use that to show independence. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Dave Gosselin
dave.gosselin@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-31180: MyISAMMRG Crash on UPDATE of an updateable VIEW Attach the children of a MERGE table once per statement, and keep the value of pos_in_table_list for a MERGE table on subsequent executions of a prepared statement. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Mohammad Tafzeel Shams
tafzeel.shams@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41242 : Fix resource leaks on InnoDB/mariabackup error paths found by Infer Several error-handling paths returned without releasing a resource already acquired earlier in the function, or checked the wrong handle entirely, risking use of an unopened handle. Changes: - SysTablespace::read_lsn_and_check_flags(): close the datafile handle on header-validation failure. - xb_process_datadir(): check the freshly opened `dir` handle instead of the stale `dbdir`, fixing a handle leak and a possible use of an unopened directory handle. - wsrep.cc / xb_load_list_file(): close file handles before die(), and null-check fopen() results in wsrep.cc. - datadir_iter_new(): free datadir_path and destroy the mutex on the os_file_opendir() failure path. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Brad Smith
brad@comstyle.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
crc32c: check elf_aux_info() return value in ppc64 probe elf_aux_info(3) leaves the output buffer unmodified on failure, so ignoring the return value could test an uninitialized cpufeatures and wrongly enable the POWER8 vector-crypto path. Treat failure as "no features" so the probe falls back to the generic implementation. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
sjaakola
seppo.jaakola@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41385 wsrep_sync_wait has no effect after COM_CHANGE_USER │ Also reported as: https://github.com/mariadb-corporation/galera/issues/613. THD::cleanup() cleared THD::wsrep_client_thread. Besides connection │ close, THD::cleanup() is also called from THD::change_user() when │ handling COM_CHANGE_USER and COM_RESET_CONNECTION. THD::init() does │ not set the flag back, and the only place that sets it is │ thd_prepare_connection(). After either command the session was no │ longer treated as a wsrep client connection: WSREP_CLIENT() returned │ false for the rest of the session. │ As a result wsrep_sync_wait was silently ignored, so causal reads │ could return stale data. Such connections were also skipped by │ wsrep_close_client_connections() and │ wsrep_wait_committing_connections_close(). Connection pools issue │ COM_RESET_CONNECTION whenever a connection is reused, so in practice │ most pooled sessions were affected. │ Fix by moving the reset of wsrep_client_thread from THD::cleanup() │ to end_connection(), after wsrep_close(). The galera.galera_change_user test is extended to do a causal read │ Couldn't read the git diff — it will retry on the next change on a fresh connection, after COM_CHANGE_USER and after │ COM_RESET_CONNECTION. Each read must increase the provider's │ wsrep_causal_reads status counter. │ |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Aleksey Midenkov
midenok@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-29566 parts.partition_special_innodb unstable DROP TABLE fix The test sporadically fails with ER_LOCK_WAIT_TIMEOUT on DROP TABLE t1 of the Bug#53676 test case (see MDEV-29566). mysqltest: At line 119: query 'DROP TABLE t1' failed: ER_LOCK_WAIT_TIMEOUT (1205): Lock wait timeout exceeded; try restarting transaction The DROP TABLE is executed by con2 with lock_wait_timeout=0. The INSERT puts two rows into each partition, which exceeds the auto recalc threshold of persistent statistics, so the partitions are added to the recalc pool. The statistics background thread opens the partitions with a shared MDL on t1, and if it does so at the moment of DROP TABLE, the MDL request fails instantly. The fix creates the table with STATS_PERSISTENT=0. The test case is not about statistics; this also avoids locking mysql.innodb_table_stats and mysql.innodb_index_stats in ha_innobase::delete_table() when the failed ALTER TABLE ... ADD PARTITION rolls back the new partitions. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Vladislav Vaintroub
vvaintroub@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-39533 Resolve reparse points and enforce MY_NOSYMLINKS on Windows On Windows, my_realpath() only called GetFullPathName(), does not resolve symlinks, junctions or mount points, unlike POSIX realpath(). At the same time, my_open() and my_delete() ignored MY_NOSYMLINKS entirely, so the symlink-attack protection used for MyISAM/Aria's DATA DIRECTORY/INDEX DIRECTORY (mi_open()/ma_open(), my_handler_delete_with_symlink()) was silently absent on Windows. Fix my_realpath() to actually resolve reparse points: open the path with CreateFile(), which follows them, and read back the handle's fully resolved path with GetFinalPathNameByHandle(). As a result, a missing path now correctly returns 1/ENOENT on Windows too, matching Linux's realpath()-based behavior, instead of always returning 0. Make my_open() and my_delete() honor MY_NOSYMLINKS on Windows. Windows has no per-path-component O_NOFOLLOW equivalent, so instead this mirrors the HAVE_REALPATH branch of the POSIX NOSYMLINK_FUNCTION_BODY macro: the caller-supplied name (expected to already be my_realpath()-resolved) is compared against the actually opened handle's resolved path, and rejected with ENOTDIR -- the same errno POSIX uses for this exact "not already canonical" condition -- on a mismatch, whether caused by a TOCTOU symlink swap or by the name never having been fully resolved to begin with. Known limitation: GetFinalPathNameByHandle(FILE_NAME_NORMALIZED), used by both my_realpath() and MY_NOSYMLINKS verification, can fail on some SMB shares (an intermediate directory denying list/read access while still allowing traverse). When that happens, both fall back to the weaker FILE_NAME_OPENED query: my_realpath() still succeeds, but MY_NOSYMLINKS verification is weaker, since FILE_NAME_OPENED may not fully resolve reparse points. A one-time warning naming the affected path is raised the first time this happens. As part of enforcing MY_NOSYMLINKS for my_delete(), my_win_unlink() (formerly in my_delete.c) is rewritten and moved to my_winfile.cc It opens file once, and verifies no symlinks, before removing it. Co-Authored-By: Claude Sonnet 5 <[email protected]> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ParadoxV5
paradox.ver5@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Merge branch '11.4' into MDEV-38849 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
bsrikanth-mariadb
srikanth.bondalapati@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41243, MDEV-41273 Don't freeze mem_root after engine pushdown When a statement is pushed down to an engine, the once-per-statement part of the optimization (e.g. the first_cond_optimization part of JOIN::optimize(), or the whole of JOIN::optimize() for a pushed down UNION) is skipped. Re-executing the same prepared statement or stored routine without pushdown then allocated from a mem_root already marked ROOT_FLAG_READ_ONLY, hitting an assertion in alloc_root(). Add LEX::dont_freeze_mem_root, set by the pushdown_handler and derived_handler constructors so it covers every engine implementing them. Prepared_statement::execute_loop(), sp_head::execute() (through sp_head::dont_freeze_mem_root) and the SP instruction reparse path no longer freeze the mem_root of such statements. The flag is only declared and used in PROTECT_STATEMENT_MEMROOT builds. Note this disables the mem_root protection for the statement for good, even if later executions are not pushed down. For a stored routine one pushed down instruction disables it for the whole routine. Add tests for prepared SELECT, UNION, UPDATE and DELETE, prepared EXPLAIN of a pushed UNION, derived tables, stored procedures, functions, triggers, cursors and metadata-invalidation reparse, with pushdown switched on and off in either order. The routine and prepared statement tests check the statements received by the remote server to verify that pushdown actually happened. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alexander Barkov
bar@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41246 "Illegal mix of collations" on the mysql.user view This SQL script failed: SET NAMES latin1 COLLATE latin1_swedish_ci; CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1; SET NAMES big5 COLLATE big5_chinese_ci; SELECT * FROM v1 WHERE c1='y'; with the following error: ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '=' Note, latin1_swedish_ci and big5_chinese_ci are used here as examples. The error also happened with different collation combinations. Fix main idea: If two collations have equal comparison rules (known as "tailoring") on a given character repertoire, like latin1_swedish_ci and big5_chinese_ci on ASCII letters, then the "Illegal mix of collation" error can be avoided in a comparison operator. We can choose any of the sides as the operation effective collation - the result will be equal. This optimization is not applied when both sides have an explicit COLLATE clause. Two explicit COLLATE clauses in one comparison is already illegal when the character sets are the same, so for consistency it stays illegal when the character sets differ too. Most important details: - Splitting enum_repertoire_t into smaller subsets, for better repertoire granularity. A variable holding a repertoire value can now have multiple MY_REPEROIRE_XXX flags set. This patch implements detecting tailoring equality on this reperoires: * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9]. * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore * MY_REPERTOIRE_ASCII - the entire range U+0000..U+007F - Adding a new virtual function "tailoring" in my_collation_handler_st It returns the tailoring on the given repertoire for the given collation. If cs1->cset->tailoring(cs1, some_repertoire) returns {0,0}, it means illegal mix optimization cannot be used for this collation on the given repertoire. If these calls: tr1= cs1->cset->tailoring(cs1, some_repertoire); tr2= cs2->cset->tailoring(cs2, some_repertoire); return both non-NULL results and tr1.ptr==tr2.ptr, then these collations are equal on the given repertoire and are mutually replaceable for a comparison operator, so "Illegal mix of collations" can be avoided. - Adding a new method DTCollation::aggregate_by_repertoire(). - Adding a new flag MY_COLL_ALLOW_BY_REPERTOIRE. It indicates to DTCollation::aggregate() that the illegal mix optimization by repertoire can be used in the given context. MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_REPERTOIRE. Note, only comparison operators pass this flag. Functions returning a string result do not pass this flag, because in operations like CONCAT(a,b) we still need to evaluate precisely the collation of the result - we cannot just choose a collation of one of the sides (even if they are compatible on the given repertoire). - As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits rather than a single bit, the way how to detect "is only ASCII" repertoires has changed in the code. For example: // repertoire *IS* ascii if (repertoire == MY_REPERTOIRE_ASCII) has changed in multiple places in the code to // repertoire *HAS* only ascii characters if (!(repertoire & ~MY_REPERTOIRE_ASCII)) - New flags were added int for CHARSET_INFO::state * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation does not has no irregularities on the ASCII range. * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has not irregularities on the IDENT subrange only (but can have irregularities say on punctuation). * MY_CS_ASCII_STD_UCA - for UCA collations. It means that a UCA collation does not reorder ASCII letters. - strings/conf_to_src.c was modified to detect and print MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags. - strings/ctype-extra.c was regenerated with new flags. - Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/. They display a tailoring by collation name and repertoire as returned by: cs->cset->tailoring(cs, some_repertoire) A dynamically linked plugin function collation_tailoring() was added for the purpose of these tests. - Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test They display two-dimensional charts showing which collations are compatible on which repertoires. - Adding a number of MTR tests in the form of the originally reported stript for various collations: SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...'; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
KhaledR57
khaled57.dev@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-32383 Server crashes in Item_func_match::init_search on 2nd execution of PS Item_func_match::master points at an equal MATCH item that owns the shared ft_handler. setup_ftfuncs() sets it only when it is still unset, and cleanup() never reset it. A mergeable view is merged once. On re-execution mysql_derived_prepare() returns early because TABLE_LIST::merged is set, so the view's own MATCH item is never re-fixed and keeps the NULL table left by cleanup(). init_ftfuncs() skips unfixed items in ftfunc_list, but init_search() follows master without that check and dereferenced the NULL table. Reset master in cleanup(), after the ft_handler ownership check that reads it, so the link is rebuilt from scratch on every execution. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Vladislav Vaintroub
vvaintroub@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-39533 Resolve reparse points and enforce MY_NOSYMLINKS on Windows On Windows, my_realpath() only called GetFullPathName(), does not resolve symlinks, junctions or mount points, unlike POSIX realpath(). At the same time, my_open() and my_delete() ignored MY_NOSYMLINKS entirely, so the symlink-attack protection used for MyISAM/Aria's DATA DIRECTORY/INDEX DIRECTORY (mi_open()/ma_open(), my_handler_delete_with_symlink()) was silently absent on Windows. Fix my_realpath() to actually resolve reparse points: open the path with CreateFile(), which follows them, and read back the handle's fully resolved path with GetFinalPathNameByHandle(). As a result, a missing path now correctly returns 1/ENOENT on Windows too, matching Linux's realpath()-based behavior, instead of always returning 0. Make my_open() and my_delete() honor MY_NOSYMLINKS on Windows. Windows has no per-path-component O_NOFOLLOW equivalent, so instead this mirrors the HAVE_REALPATH branch of the POSIX NOSYMLINK_FUNCTION_BODY macro: the caller-supplied name (expected to already be my_realpath()-resolved) is compared against the actually opened handle's resolved path, and rejected with ENOTDIR -- the same errno POSIX uses for this exact "not already canonical" condition -- on a mismatch, whether caused by a TOCTOU symlink swap or by the name never having been fully resolved to begin with. As part of enforcing MY_NOSYMLINKS for my_delete(), my_win_unlink() (formerly in my_delete.c) is rewritten and moved to my_winfile.cc It opens file once, and verifies no symlinks, before removing it. Co-Authored-By: Claude Sonnet 5 <[email protected]> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alexander Barkov
bar@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41246 "Illegal mix of collations" on the mysql.user view This SQL script failed: SET NAMES latin1 COLLATE latin1_swedish_ci; CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1; SET NAMES big5 COLLATE big5_chinese_ci; SELECT * FROM v1 WHERE c1='y'; with the following error: ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '=' Note, latin1_swedish_ci and big5_chinese_ci are used here as examples. The error also happened with different collation combinations. Fix main idea: If two collations have equal comparison rules (known as "tailoring") on a given character repertoire, like latin1_swedish_ci and big5_chinese_ci on ASCII letters, then the "Illegal mix of collations" error can be avoided in a comparison operator. We can choose any of the sides as the operation effective collation - the result will be equal. This optimization is not applied when at least one side has an explicit COLLATE clause. Two explicit COLLATE clauses in one comparison are already illegal when the character sets are the same, so for consistency this stays illegal when the character sets differ too. Most important details: - Splitting enum_repertoire_t into smaller subsets, for better repertoire granularity. A variable holding a repertoire value can now have multiple MY_REPERTOIRE_XXX flags set. This patch implements detecting tailoring equality on these repertoires: * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9]. * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore * MY_REPERTOIRE_ASCII - the entire range U+0000..U+007F - Adding a new virtual function "tailoring" in my_collation_handler_st. It returns the tailoring on the given repertoire for the given collation. If cs1->coll->tailoring(cs1, some_repertoire) returns {0,0}, it means the illegal mix optimization cannot be used for this collation on the given repertoire. If these calls: tr1= cs1->coll->tailoring(cs1, some_repertoire); tr2= cs2->coll->tailoring(cs2, some_repertoire); return both non-NULL results and tr1.str==tr2.str, then these collations are equal on the given repertoire and are mutually replaceable for a comparison operator, so "Illegal mix of collations" can be avoided. - Adding a new method DTCollation::aggregate_by_tailoring(). Like the other successful branches of DTCollation::aggregate(), it makes the resulting repertoire cover both sides. - Adding a new flag MY_COLL_ALLOW_BY_TAILORING. It indicates to DTCollation::aggregate() that the illegal mix optimization by repertoire can be used in the given context. MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_TAILORING. Note, only comparison operators pass this flag. Functions returning a string result do not pass this flag, because in operations like CONCAT(a,b) we still need to evaluate precisely the collation of the result - we cannot just choose a collation of one of the sides (even if they are compatible on the given repertoire). This also applies to ExtractValue() and UpdateXML(), which now aggregate their arguments without this flag. - As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits rather than a single bit, the way to detect "is only ASCII" repertoires has changed in the code. For example: // repertoire *IS* ascii if (repertoire == MY_REPERTOIRE_ASCII) has changed in multiple places in the code to // repertoire *HAS* only ascii characters if (!(repertoire & ~MY_REPERTOIRE_ASCII)) - Repertoire of some expressions was adjusted to the new meaning: * Item_null now has MY_REPERTOIRE_NONE (was ASCII). * MY_LOCALE::repertoire() now returns MY_REPERTOIRE_ALL (was EXTENDED). * Lex_string_with_metadata_st::repertoire(cs) now scans the string contents to detect the actual repertoire. * HEX() has a narrower repertoire. * QUOTE, MAKE_SET, EXPORT_SET, LPAD, RPAD and GROUP_CONCAT add the repertoire of the extra characters they put into the result (quotes, separators, padding). - The tis620 collations now set CHARSET_INFO::tab_to_uni (was NULL), so my_charset_is_ascii_based() is true for tis620. This changes the result of subselect_extra_no_semijoin from an error to success. - New flags were added for CHARSET_INFO::state * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has no irregularities on the ASCII repertoire. * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has no irregularities on the IDENT repertoire (but can have irregularities say on punctuation). * MY_CS_ASCII_STD_UCA - for UCA collations. It means that a UCA collation does not reorder ASCII characters. - strings/conf_to_src.c was modified to detect and print MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags. - strings/ctype-extra.c was regenerated with new flags. - Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/. They display a tailoring by collation name and repertoire as returned by: cs->coll->tailoring(cs, some_repertoire) A dynamically linked plugin function collation_tailoring() was added for the purpose of these tests. - Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test They display two-dimensional charts showing which collations are compatible on which repertoires. - Adding a number of MTR tests in the form of the originally reported script for various collations: SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...'; - Adding tests to ctype_cp932.test checking that ExtractValue() and UpdateXML() still raise "Illegal mix of collations". |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
bsrikanth-mariadb
srikanth.bondalapati@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41243, MDEV-41273: fedx pushdown assert for UPDATE/DELETE prepared stmts When a statement is pushed down to an engine, JOIN::optimize() skips its once-per-statement work. Re-executing the same prepared statement or stored routine without pushdown then allocated from a mem_root already marked ROOT_FLAG_READ_ONLY, hitting an assertion in alloc_root(). Add LEX::dont_freeze_mem_root, set by the pushdown_handler and derived_handler constructors so it covers every engine implementing them. Prepared_statement::execute_loop(), sp_head::execute() (through sp_head::dont_freeze_mem_root, PROTECT_STATEMENT_MEMROOT builds only) and the SP instruction reparse path no longer freeze the mem_root of such statements. Note this disables the mem_root protection for them. Add tests for prepared statements, stored procedures, functions, triggers, cursors and metadata-invalidation reparse, with pushdown switched on and off in either order. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sergei Golubchik
serg@mariadb.org |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
fix building of external plugins ARG_DEPENDS might be empty. tests should be under <pluginname>/ not under whatever build dir happened to be named. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alexander Barkov
bar@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41246 "Illegal mix of collations" on the mysql.user view This SQL script failed: SET NAMES latin1 COLLATE latin1_swedish_ci; CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1; SET NAMES big5 COLLATE big5_chinese_ci; SELECT * FROM v1 WHERE c1='y'; with the following error: ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '=' Note, latin1_swedish_ci and big5_chinese_ci are used here as examples. The error also happened with different collation combinations. Fix main idea: If two collations have equal comparison rules (known as "tailoring") on a given character repertoire, like latin1_swedish_ci and big5_chinese_ci on ASCII letters, then the "Illegal mix of collation" error can be avoided in a comparison operator. We can choose any of the sides as the operation effective collation - the result will be equal. Most important details: - Splitting enum_repertoire_t into smaller subsets, for better repertoire granularity. A variable holding a repertoire value can now have multiple MY_REPEROIRE_XXX flags set. This patch implements detecting tailoring equality on this reperoires: * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9]. * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore * MY_REPERTOIRE_ASCII - the entire range U+0000..U+007F - Adding a new virtual function "tailoring" in my_collation_handler_st It returns the tailoring on the given repertoire for the given collation. If cs1->cset->tailoring(cs1, some_repertoire) returns {0,0}, it means illegal mix optimization cannot be used for this collation on the given repertoire. If these calls: tr1= cs1->cset->tailoring(cs1, some_repertoire); tr2= cs2->cset->tailoring(cs2, some_repertoire); return both non-NULL results and tr1.ptr==tr2.ptr, then these collations are equal on the given repertoire and are mutually replaceable for a comparison operator, so "Illegal mix of collations" can be avoided. - Adding a new method DTCollation::aggregate_by_repertoire(). - Adding a new flag MY_COLL_ALLOW_BY_REPERTOIRE. It indicates to DTCollation::aggregate() that the illegal mix optimization by repertoire can be used in the given context. MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_REPERTOIRE. Note, only comparison operators pass this flag. Functions returning a string result do not pass this flag, because in operations like CONCAT(a,b) we still need to evaluate precisely the collation of the result - we cannot just choose a collation of one of the sides (even if they are compatible on the given repertoire). - As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits rather than a single bit, the way how to detect "is only ASCII" repertoires has changed in the code. For example: // repertoire *IS* ascii if (repertoire == MY_REPERTOIRE_ASCII) has changed in multiple places in the code to // repertoire *HAS* only ascii characters if (!(repertoire & ~MY_REPERTOIRE_ASCII)) - New flags were added int for CHARSET_INFO::state * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation does not has no irregularities on the ASCII range. * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations. It means that this collation has not irregularities on the IDENT subrange only (but can have irregularities say on punctuation). * MY_CS_ASCII_STD_UCA - for UCA collations. It means that a UCA collation does not reorder ASCII letters. - strings/conf_to_src.c was modified to detect and print MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags. - strings/ctype-extra.c was regenerated with new flags. - Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/. They display a tailoring by collation name and repertoire as returned by: cs->cset->tailoring(cs, some_repertoire) A dynamically linked plugin function collation_tailoring() was added for the purpose of these tests. - Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test They display two-dimensional charts showing which collations are compatible on which repertoires. - Adding a number of MTR tests in the form of the originally reported stript for various collations: SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...'; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alessandro Vetere
iminelink@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-39792 InnoDB: ALTER TABLE FORCE triggers assertion "s" in buf_page_get_gen() When rebuilding a table from ROW_FORMAT=COMPACT or DYNAMIC into ROW_FORMAT=REDUNDANT, row_merge_buf_add() fetches the full value of an externally stored (off-page) CHAR column in a multi-byte character set and pads it to REDUNDANT's fixed local width via row_merge_buf_redundant_convert(). That helper already dereferences the BLOB and calls dfield_set_data(), which clears the field's "externally stored" flag, since the value is now held in full locally. The "flag externally stored fields" step further down in row_merge_buf_add() did not know this had happened. It still consulted the row_ext_t cache built from the original (pre-conversion) record and, for a column that is not part of the clustered index's unique key, called dfield_set_ext() again on the very field that had just been converted, without restoring its data pointer to a valid 20-byte external reference. row_merge_copy_blobs() would then read the tail of the padded, space-filled buffer as if it were a BTR_EXTERN_FIELD_REF, deriving a garbage tablespace id and crashing buf_page_get_gen()'s fil_space_get() assertion when the alter tried to build the new clustered index. Skip the re-flagging step for a field whose "externally stored" flag is no longer set. row_build() flags every off-page column, and the row_ext_t cache only holds a subset of those columns, so a field that is not flagged is either a converted one (already fully local) or one that the cache does not hold. With the field no longer re-flagged, the rebuild completes, and the rebuilt table passes CHECK TABLE with the full column value. The MDEV-31025 case in innodb.default_row_format_alter failed on innodb_page_size=4k and 8k: its ROW_FORMAT=REDUNDANT table has eight utf32 CHAR(255) columns, which CREATE TABLE rejects with ER_TOO_BIG_ROWSIZE on those page sizes. Derive the number of columns from the page size, so that the record still exceeds the maximum local record size and the fixed-length column c is stored externally. The whole test now passes on every page size. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ParadoxV5
paradox.ver5@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-38849 slave_connections_needed_for_purge prevents independent machine from purging binary logs `@@slave_connections_needed_for_purge`’s default of `1` ensures binary log availability on replication masters, but is not a sensible default suitable for all scenarios, especially for long-term slave servers and standalone (not in a replication setup) servers. The outcome was that standalone server users were confused why automatic binlog purging does not work. This commit changes this default to `0`, which is suitable for both standalone and (when backed by prompt failure recovery) replication setups. `0` also more closely matches the behaviour before MDEV-31404, which added this variable, out of the box. This commit also adds a one-time replication warning when registering a slave, but `@@slave_connections_needed_for_purge` is left unchanged. Rather than enforcing a defence with an unsensible default, this reminder will bring awareness of the risk of automatic binlog purging. This commit also cleans up Galera and MTR workarounds to the introduction of the `@@slave_connections_needed_for_purge=1` default. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||