Commit graph

25818 commits

Author SHA1 Message Date
Marko Mäkelä
4010dff058 mtr_t::log_file_op(): Fix -Wnonnull
GCC 12.2.0 could issue -Wnonnull for an unreachable call to
strlen(new_path).  Let us prevent that by replacing the condition
(type == FILE_RENAME) with the equivalent (new_path).
This should also optimize the generated code, because the life time
of the parameter "type" will be reduced.
2024-09-14 11:05:44 +03:00
Yuchen Pei
cc0faa1e3e
MDEV-31788 Factor functions to reduce duplication around spider_check_and_init_casual_read in ha_spider.cc
factored out static functions:
- spider_prep_loop
- spider_start_bg
- spider_send_queries
2024-09-10 11:52:26 +10:00
Yuchen Pei
0ba97e4dc6
MDEV-31788 Factor out calls to spider_ping_table_mon_from_table in ha_spider.cc 2024-09-10 11:52:26 +10:00
Yuchen Pei
9e1579788f
MDEV-31788 Factor spider locking and unlocking code around sending queries 2024-09-10 11:52:22 +10:00
Yuchen Pei
84067291b4
MDEV-28360 Spider: remove #ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name 2024-09-10 11:19:19 +10:00
Yuchen Pei
f5b7c25e1e
MDEV-27643 Spider: remove #ifdef HA_CAN_BULK_ACCESS 2024-09-10 11:19:19 +10:00
Yuchen Pei
e7570c7759
MDEV-31788 Remove spider_file_pos
They are for unnecessary debugging purposes only.
2024-09-10 11:19:18 +10:00
Yuchen Pei
a81f419b06
MDEV-27648 remove #define HASH_UPDATE_WITH_HASH_VALUE
The functions called in blocks protected by this macro remain
undefined as of 11.5 c96b23f994
2024-09-10 11:19:14 +10:00
Yuchen Pei
5d54e86c22
MDEV-26178 spider: delete spd_environ.h
It's virtually empty now
2024-09-10 11:15:18 +10:00
Yuchen Pei
869c501ac3
MDEV-27644 Spider: remove HANDLER_HAS_DIRECT_AGGREGATE 2024-09-10 11:15:18 +10:00
Yuchen Pei
3a58291680
MDEV-27662 remove SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE 2024-09-10 11:15:17 +10:00
Yuchen Pei
84977868b1
MDEV-27809 remove SPIDER_I_S_USE_SHOW_FOR_COLUMN
Show::Column() was added in MDEV-19772
4156b1a260
2024-09-10 11:15:17 +10:00
Yuchen Pei
6287fb6e17
MDEV-27652 remove #ifdef HA_HAS_CHECKSUM_EXTENDED
handler::pre_calculate_checksum was added in MDEV-16249
be5c432a42
2024-09-10 11:15:17 +10:00
Yuchen Pei
e8a5553cef
MDEV-27808 remove SPIDER_LIKE_FUNC_HAS_GET_NEGATED
get_negated() was introduced in MDEV-16707
2024-09-10 11:15:16 +10:00
Yuchen Pei
ab49b46d01
MDEV-27664 remove SPIDER_SQL_CACHE_IS_IN_LEX
sql_cache was moved to lex in MDEV-11953 in
de745ecf29
2024-09-10 11:15:16 +10:00
Yuchen Pei
a1e5ee9111
MDEV-27663 remove SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
{STRING|INT|REAL|DECIMAL|DATE}_ITEM were replaced with CONST_ITEM in
MDEV-14630 c20cd68e60
2024-09-10 11:15:16 +10:00
Yuchen Pei
5e98471df1
MDEV-27811: remove SPIDER_MDEV_16246
MDEV-16246 was fixed long ago. And this macro was removed in other
versions too
2024-09-10 11:15:15 +10:00
Yuchen Pei
8c8684b17f
MDEV-28226 Remove HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
handler::need_info_for_auto_inc() was added in MDEV-7720 / MDEV-7726
in commit dc17ac1638
2024-09-10 11:15:15 +10:00
Yuchen Pei
affcb0713d
MDEV-26178 spider: remove PARTITION_HAS_GET_PART_SPEC
This macro is unused, and not in 11.5 c96b23f994
2024-09-10 11:15:15 +10:00
Yuchen Pei
6d0d09ebc2
MDEV-26178 Spider: remove HANDLER_HAS_TOP_TABLE_FIELDS
This macro is unused
2024-09-10 11:15:14 +10:00
Yuchen Pei
1cb75d9a33
MDEV-27660 Remove #ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
The flag argument was added to handler::start_bulk_insert() in
the MDEV-539 commit
ca2cdaad86
2024-09-10 11:15:14 +10:00
Yuchen Pei
aaba68ac1e
MDEV-28896 Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
new_data is const since at least 2017: a05a610d60
2024-09-10 11:15:14 +10:00
Yuchen Pei
f16c037753
MDEV-28895 Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
handler has can_use_for_auto_inc_init() since at latest 2017:
dc17ac1638
2024-09-10 11:15:14 +10:00
Yuchen Pei
0650c87d9b
MDEV-27647 Spider: remove HANDLER_HAS_DIRECT_UPDATE_ROWS 2024-09-10 11:15:13 +10:00
Yuchen Pei
d5d65b948b
MDEV-26178 Spider: remove HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
HA_EXTRA_USE_CMP_REF is undefined, and remains so as of 11.5
c96b23f994
2024-09-10 11:15:13 +10:00
Yuchen Pei
de3dd942c0
MDEV-28894 Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
HA_EXTRA_STARTING_ORDERED_INDEX_SCAN was added latest 2018:
921c5e9314
2024-09-10 11:15:13 +10:00
Yuchen Pei
64581c83e8
MDEV-28893 Spider: remove #ifdef SPIDER_NET_HAS_THD
net has thd since 2015 in 56aa19989f for MDEV-6152
2024-09-10 11:15:12 +10:00
Yuchen Pei
ba9bebd719
MDEV-28892 remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED
arg_count was protected since 2015 in commit
afa1773439
2024-09-10 11:15:12 +10:00
Yuchen Pei
05fafaf82d
MDEV-27646 remove SPIDER_HAS_HASH_VALUE_TYPE
unifdef -DSPIDER_HAS_HASH_VALUE_TYPE -m storage/spider/spd_* storage/spider/ha_spider.* storage/spider/hs_client/*
2024-09-10 11:15:12 +10:00
Marko Mäkelä
f06060f5ed Cleanup: Remove the function dict_remove_db_name() 2024-09-06 14:31:55 +03:00
Marko Mäkelä
024a18dbcb MDEV-34823 Invalid arguments in ib_push_warning()
In the bug report MDEV-32817 it occurred that the function
row_mysql_get_table_status() is outputting a fil_space_t*
as if it were a numeric tablespace identifier.

ib_push_warning(): Remove. Let us invoke push_warning_printf() directly.

innodb_decryption_failed(): Report a decryption failure and set the
dict_table_t::file_unreadable flag. This code was being duplicated in
very many places. We return the constant value DB_DECRYPTION_FAILED
in order to avoid code duplication in the callers and to allow tail calls.

innodb_fk_error(): Report a FOREIGN KEY error.

dict_foreign_def_get(), dict_foreign_def_get_fields(): Remove.
This code was being used in dict_create_add_foreign_to_dictionary()
in an apparently uncovered code path. That ib_push_warning() call
would pass the integer i+1 instead of a pointer to NUL terminated
string ("%s"), and therefore the call should have resulted in a crash.

dict_print_info_on_foreign_key_in_create_format(),
innobase_quote_identifier(): Add const qualifiers.

row_mysql_get_table_error(): Replaces row_mysql_get_table_status().
Display no message on DB_CORRUPTION; it should be properly reported at
the SQL layer anyway.
2024-09-06 14:29:09 +03:00
Daniel Black
8024b8e4c1 MDEV-33091 pcre2 headers - handle columnstore
From e735cf2ed7cefb2af36f10f3cb47dfc060789df3, the PCRE_INCLUDES
changed to PCRE_INCLUDE_DIRS for consistency.

The columnstore module depends on the old name.

Create a mapping for the columnstore submodule.

10.6+ fix for submodule is:
* https://github.com/mariadb-corporation/mariadb-columnstore-engine/pull/3304
2024-09-05 12:14:06 +10:00
Sergei Golubchik
b2ebe1cb7b MDEV-33091 pcre2 headers aren't found on Solaris
use pkg-config to find pcre2, if possible

rename PCRE_INCLUDES to use PKG_CHECK_MODULES naming, PCRE_INCLUDE_DIRS
2024-09-05 12:14:06 +10:00
Marko Mäkelä
1ff6b6f0b4 MDEV-34802 Recovery fails to note some log corruption
recv_recovery_from_checkpoint_start(): Abort startup due to log
corruption if we were unable to parse the entire log between
the latest log checkpoint and the corresponding FILE_CHECKPOINT record.

Also, reduce some code bloat related to log output and log_sys.mutex.

Reviewed by: Debarun Banerjee
2024-08-28 15:44:42 +03:00
Marko Mäkelä
e7bb9b7c55 MDEV-24923 fixup: Correct a function comment 2024-08-27 18:06:24 +03:00
Yuchen Pei
58bc83e1a7
[fixup] Spider: Restored lines accidentally deleted in MDEV-32157
Also restored a change that resulted in off-by-one, as well as
appending the correctly indexed key_hint.
2024-08-27 15:36:39 +10:00
Monty
1f040ae048 MDEV-34043 Drastically slower query performance between CentOS (2sec) and Rocky (48sec)
One cause of the slowdown is because the ftruncate call can be much
slower on some systems.  ftruncate() is called by Aria for internal
temporary tables, tables created by the optimizer, when the upper level
asks Aria to delete the previous result set. This is needed when some
content from previous tables changes.

I have now changed Aria so that for internal temporary tables we don't
call ftruncate() anymore for maria_delete_all_rows().

I also had to update the Aria repair code to use the logical datafile
size and not the on-disk datafile size, which may contain data from a
previous result set.  The repair code is called to create indexes for
the internal temporary table after it is filled.
I also replaced a call to mysql_file_size() with a pwrite() in
_ma_bitmap_create_first().

Reviewer: Sergei Petrunia <sergey@mariadb.com>
Tester: Dave Gosselin <dave.gosselin@mariadb.com>
2024-08-21 22:47:29 +03:00
Marko Mäkelä
e40dfcdd89 Fix clang++-19 -Wunused-but-set-variable 2024-08-15 10:13:49 +03:00
Jan Lindström
cd8b8bb964 MDEV-34594 : Assertion `client_state.transaction().active()' failed in
int wsrep_thd_append_key(THD*, const wsrep_key*, int, Wsrep_service_key_type)

CREATE TABLE [SELECT|REPLACE SELECT] is CTAS and idea was that
we force ROW format. However, it was not correctly enforced
and keys were appended before wsrep transaction was started.

At THD::decide_logging_format we should force used stmt binlog
format to ROW in CTAS case and produce a warning if used
binlog format was not ROW.

At ha_innodb::update_row we should not append keys similarly
as in ha_innodb::write_row if sql_command is SQLCOM_CREATE_TABLE.
Improved error logging on ::write_row, ::update_row and ::delete_row
if wsrep key append fails.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-08-12 23:54:30 +02:00
Nikita Malyavin
25e2d0a6bb MDEV-34632 Assertion failed in handler::assert_icp_limitations
Assertion `table->field[0]->ptr >= table->record[0] &&
table->field[0]->ptr <= table->record[0] + table->s->reclength' failed in
handler::assert_icp_limitations.

table->move_fields has some limitations:
1. It cannot be used in cascade
2. It should always have a restoring pair.

Rule 1 is covered by assertions in handler::assert_icp_limitations
and handler::ptr_in_record (commit 30894fe9a9).

Rule 2 should be manually maintained with care. Hopefully, the rule 1 assertions
may sometimes help as well.

In ha_myisam::repair, both rules are broken. table->move_fields is used
asymmetrically there: it is set on every param->fix_record call
(i.e. in compute_vcols) but is restored only once, in the end of repair.

The reason to updating field ptr's for every call is that compute_vcols can
(supposedly) be called in parallel, that is, with the same table, but different
records.

The condition to "unmove" the pointers in ha_myisam::restore_vcos_after_repair
is incorrect, when stored vcols are available, and myisam stores a VIRTUAL field
if it's the only field in the table (the record cannot be of zero length).

This patch solves the problem by "unmoving" the pointers symmetrically, in
compute_vcols. That is, both rules will be preserved maintained.
2024-08-07 14:50:19 +02:00
Yuchen Pei
bce3f3f628
MDEV-34682 Reset spider_hton_ptr in error mode of spider_db_init() 2024-08-07 15:10:56 +10:00
Thirunarayanan Balathandayuthapani
37119cd256 MDEV-29010 Table cannot be loaded after instant ALTER
Reason:
======
- InnoDB fails to load the instant alter table metadata from
clustered index while loading the table definition.
The reason is that InnoDB metadata blob has the column length
exceeds maximum fixed length column size.

Fix:
===
- InnoDB should treat the long fixed length column as variable
length fields that needs external storage while initializing
the field map for instant alter operation
2024-08-01 18:58:43 +05:30
Thirunarayanan Balathandayuthapani
533e6d5d13 MDEV-34670 IMPORT TABLESPACE unnecessary traverses tablespace list
Problem:
========
- After the commit ada1074bb1 (MDEV-14398)
fil_crypt_set_encrypt_tables() iterates through all tablespaces to
fill the default_encrypt tables list. This was a trigger to
encrypt or decrypt when key rotation age is set to 0. But import
tablespace does call fil_crypt_set_encrypt_tables() unnecessarily.
The motivation for the call is to signal the encryption threads.

Fix:
====
ha_innobase::discard_or_import_tablespace: Remove the
fil_crypt_set_encrypt_tables() and add the import tablespace
to the default encrypt list if necessary
2024-07-31 14:13:38 +05:30
Thirunarayanan Balathandayuthapani
c038b3c05e MDEV-34181 Instant table aborts after discard tablespace
- commit 85db534731 (MDEV-33400)
retains the instantness in the table definition after discard
tablespace. So there is no need to assign n_core_null_bytes
during instant table preparation unless they are not
initialized.
2024-07-30 13:31:43 +05:30
Marko Mäkelä
7e5c9ccda5 MDEV-34502 fixup: Do not cripple MSAN
We need to work around deficiencies of Valgrind, and apparently
the previous work-around attempts
(such as d247d64988) do not work
anymore, definitely not on recent clang-based compilers.

MemorySanitizer should be fine; unfortunately we set HAVE_valgrind for it
as well.
2024-07-29 15:04:16 +03:00
Sergei Golubchik
d20518168a also protect the /*!999999 sandbox comment 2024-07-17 21:25:40 +02:00
Sutou Kouhei
383d53edbc MDEV-21166 Add Mroonga initialized check to Mroonga UDFs
Mroonga UDFs can't be used without loading Mroonga.
2024-07-17 15:52:58 +10:00
Yuchen Pei
03a350378a
MDEV-30408 Reset explicit_limit in exists2in
Item_exists_subselect::fix_length_and_dec() sets explicit_limit to 1.
In the exists2in transformation it resets select_limit to NULL. For
consistency we should reset explicity_limit too.

This fixes a bug where spider table returns wrong results for queries
that gets through exists2in transformation when semijoin is off.
2024-07-17 08:54:40 +08:00
Yuchen Pei
8416fd323c
MDEV-32627 [fixup] Spider: Fix conn key length
To avoid off-by-one in spider_get_share.

And document conn key and conn key length.
2024-07-17 08:52:35 +08:00
Yuchen Pei
20d99f3f86
MDEV-32627 Distinguish between absence of a keyword and empty value for the keyword
Distinguish them in two place:

when constructing connection key in create_conn_key and
spider_create_conn for both ordinary queries and spider_direct_sql

For spider_create_conn and spider_udf_direct_sql_create_conn, the
created conn gets assigned a field from the source object if and only
if source->field is non-null.

For spider_create_conn_keys and spider_udf_direct_sql_create_conn_key,
we update the encoding so that absence of keyword and keyword with an
empty value result in different keys. More specifically, if the i-th
keyword has a value, the corresponding part in the conn key begins
with the char \i, followed by the possibly empty value and ends with a
\0. If the i-th keyword is not specified, then it does not get a
mention in the conn key.

As part of this change, we also update table param / option parsing to
recognise a singleton empty string when creating an string list,
instead of writing it off as NULL.
2024-07-17 08:51:44 +08:00