do our own allocator that implements std::allocator interface
but uses our memory accounting (my_malloc) and limits max allocation
(e.g. to max_allowed_packet).
use it for fmt::vformat_to.
later can be used for various std:: stuff too.
Initialize keyblock to zero before EVP_BytesToKey to prevent ununitialized
access later in DES_set_key_unchecked()
Also, harden DES_ENCRYPT against second PS execution.
MDEV-39661 removed the null checking of the arguments early. This worked
if the arguments to the function where known null to begin with.
args[0]->hash_val_str() can, on evaluation, change the null value of
args[0]. As such it always nees to be executed.
The hasher.finalize still needs to be called to free the memory (like
MDEV-39661) however a 0 result when null being set is required.
Tests by Roel Van de Paar
Co-Authored-By: Claude
my_hasher_xxh32() dynamiclly allocated memory, however when a NULL
was passed to the function, a return happened before hasher.finalize(),
which freed the required memory.
Thanks Roel Van de Paar for driving AI to do most of the analysis
that scoped our the other uses of my_hasher_xxh32 and my_hasher_xxh3
as safe.
MariaDB supports XXH hash algorithms for KEY partitioning, but there is
no SQL interface for computing these hashes directly.
Add XXH32() and XXH3() scalar functions for long string data types.
Reject non-string argument data types with
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, while preserving NULL
handling. Hash string values through the charset-aware Hasher path.
Register the functions and add MTR coverage for string literals, NULL,
collation-sensitive comparisons, illegal non-string arguments, and KEY
partitioning distribution for supported string columns.
Reviewed-by: Yuchen Pei <ycp@mariadb.com>
GROUP_CONCAT is limited by group_concat_max_len,
but also, as a string function it must respect max_allowed_packet.
Let's introduce THD::gconcat_max_len() helper to simplify checks.
Also:
* make max group_concat_max_len value the same as max max_allowed_packet
* use the same MY_MIN((ulonglong) ..., UINT_MAX32) in
Item_func_json_objectagg as in Item_func_group_concat
* use overflow-safe type for lengths in Item_func_quote
(MAX_MAX_ALLOWED_PACKET is 1G so uint cannot overflow yet, but it's
a fragile assumption)
Item_func_dyncol_json::val_str() used an internal DYNAMIC_STRING
without ensuring it was freed when mariadb_dyncol_json failed.
Fixed by freeing the string in the failure case.
Update STR_TO_DATE() to accept an optional third argument for the locale.
DATE_FORMAT() and STR_TO_DATE() return NULL when the locale argument is NULL;
issue a warning and fall back to the session @@lc_time_names for invalid locale names.
STR_TO_DATE() can now be used in indexed virtual columns while having all 3 arguments,
but not allowed when 2 as it depends then on the session @@lc_time_names
removed:
* DES encryption
* --secure-auth
* --old
* spider table options: bfz, btt, cmd, ctp, cwg, isa, ilm, ios, smd, stc, stl
extended under old-mode:
* YEAR(2), still available when old-mode=2_DIGIT_YEAR
un-deprecated:
* keep_files_on_create, originally (MDEV-23570) the idea was to make it
TRUE and deprecate. It cannot be removed when FALSE, but TRUE breaks
mariabackup.aria_backup where a table is altered from Aria to InnoDB
during a backup, so both t.MAD/t.MAI and t.ibd gets into a backup.
* rename to follow the standard vprintf name convention
* remove `(LEX_CSTRING*) &lex_string` casts
* remove some redundant casts too
* LEX_CSTRING -> Lex_ident_db in path
* Hash_set<Sroutine_hash_entry>
* move assert out of the loop
* some comments and whitespace changes
Definition
==========
Implement the SET PATH statement.
```
SET PATH 'schema1, schema2, schema3';
```
Function
--------
In MariaDB, the SQL-path will also be used to lookup packages in
package routine invocations, so the following script:
SET PATH 'sys';
SELECT UTL_ENCODE.BASE64_DECODE('data');
invokes SYS.UTL_ENCODE.BASE64_DECODE('data'), i.e. the function
BASE64_DECODE() in the packge UTL_ENCODE in the database SYS
(if such package and package routine exist).
MariaDB implementation details
------------------------------
The ticket's requirement stated the grammar should support delimited
identifiers with backticks or double quotes within the string quote,
ie: the single tick. A simple parser was implemented to handle this
requirement in Sql_path::from_text.
Only 16 schemas are supported per session - we do not want too many
schemas in the path anyway since it will impact performance. This also
means that the path cache is a simple static array for easier memory
management.
Implement an improved binlog implementation that is integrated into
the storage engine. The new implementation is enabled with the
--binlog-storage-engine option. Initially the InnoDB storage engine
implements the binlog.
Integrating the binlog in the storage engine improves performance,
since it makes the InnoDB redo log the single source of truth and
avoids the need for expensive two-phase commit between binlog and
engine. It also makes it possible to disable durability (set
--innodb-flush-log-at-trx-commit=0) to further improve performance,
while still preserving the ability to recover the binlog and database
into a consistent state after a crash.
The new binlog implementation also greatly improves the internal
design and implementation of the binlog, and enables future
enhancements for replication.
This is a squash of the original 11.4-based patch series.
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
if ((res=item->val_str(str)) != str)
is incorrect way to detect whether res can be safely used,
because Item_char_typecast::val_str() can return res
which is different from str, but shares the same buffer.