Commit graph

196691 commits

Author SHA1 Message Date
Alexander Barkov
425d2521ec MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT
Do not accept rows as event parameters.
2024-11-25 18:29:13 +04:00
Alexander Barkov
20eba06d9b MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value
The patch for MDEV-23687 easlier fixed this problem. Adding tests only.
2024-11-25 16:13:16 +04:00
Alexander Barkov
2e404c9850 MDEV-21029 Incorrect result for expression with the <=> operator and IS NULL
Item_func_equal erroneously derived is_null() from the parent class.
Overriding it to return false because <=> can never return NULL.
2024-11-25 10:37:02 +04:00
Brandon Nesterenko
773cb726a8 MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict
This HEAD commit just makes cast-function-type-strict fatal.
It will stay at the HEAD, and prior commits contain the
actual fixes, organized by the part of the code that the fix
targets. Future changes will be force pushed to have their
fixes come before this HEAD.

This branch cherry-picks patches from daniel@mariadb.org
(in bb-10.5-MDEV-34508-ubsan-errors) which initially
incorporate the flag into the build, as well as fix some of
its findings.
2024-11-23 08:14:23 -07:00
Daniel Black
6456e437f2 MDEV-34348: Add cast-function-type-strict to warnings 2024-11-23 08:14:23 -07:00
Daniel Black
971a0ba23c MDEV-34408: Facilitate the addition of warnings into the build system
Create a MY_WARNING_FLAGS_NON_FATAL for testing warnings

Add -Weffc++ as no-error espect, disabling from rocksdb due
to excessive errors that will be corrected later.
2024-11-23 08:14:23 -07:00
Brandon Nesterenko
78d7bb1d27 MDEV-34348: Miscellaneous fixes
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Various additional fixes, each too small to put into
their own commit.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:23 -07:00
Brandon Nesterenko
3c785499da MDEV-34348: Fix casts relating to tree_walk_action
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:23 -07:00
Brandon Nesterenko
5432fa802b MDEV-34348: Fix casts in sql_acl
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:23 -07:00
Brandon Nesterenko
7a8eb26bda MDEV-34348: Fix casting related to plugins
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:23 -07:00
Brandon Nesterenko
840fe316d4 MDEV-34348: my_hash_get_key fixes
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Change the type of my_hash_get_key to:
 1) Return const
 2) Change the context parameter to be const void*

Also fix casting in hash adjacent areas.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:22 -07:00
Brandon Nesterenko
dbfee9fc2b MDEV-34348: Consolidate cmp function declarations
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

The functions queue_compare, qsort2_cmp, and qsort_cmp2
all had similar interfaces, and were used interchangable
and unsafely cast to one another.

This patch consolidates the functions all into the
qsort_cmp2 interface.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:22 -07:00
Alexander Barkov
3997d28f48 MDEV-16698 ASAN: heap-use-after-free in field_longstr::uncompress
This bug was earlier fixed by MDEV-16699. Adding tests only.
2024-11-22 15:46:36 +04:00
Alexander Barkov
95df7ea33a MDEV-31881 ASAN: unknown-crash in check_ulonglong (sql/sql_analyse.cc) on SELECT ... FROM ... PROCEDURE ANALYSE()
Fixing a wrong condition which made the code read 1 byte behind the buffer.
2024-11-22 14:54:08 +04:00
Alexander Barkov
39f1f30f68 MDEV-23687 Assertion `is_valid_value_slow()' failed in Datetime::Datetime upon EXTRACT under mode ZERO_DATE_TIME_CAST
Item_{date|datetime}_typecase::get_date() erroneously passed the
TIME_INTERVAL_DAY flag from the caller to args[0] which made
CAST('100000:00:00' AS DATETIME) parse '100000:00:00' as TIME
rather that DATETIME.
Suppressing this flag.
2024-11-22 12:15:03 +04:00
ParadoxV5
cf2d49ddcf Extract some of #3360 fixes to 10.5.x
That PR uncovered countless issues on `my_snprintf` uses.
This commit backports a squashed subset of their fixes.
2024-11-21 22:43:56 +11:00
Daniel Black
b414eca98d Correct cursor protocol tests main.{loaddata,grant_plugin} & innodb_fts.fulltext
Cursor protocol cannot handle select... into.

Disable this on loaddata.

For the grant_plugin/innodb_fts.fulltext changed
the tests to use a temporary table rather than a
user variable.
2024-11-21 21:43:44 +11:00
Daniel Black
2c89fe7ea6 main.stack view protocol - correct test result
View protocol requires expressions include a simple alias.
2024-11-21 21:43:44 +11:00
Monty
32962ea253 Do not read aria bitmap page for internal temporary tables
Instead create the bitmap page from scratch
2024-11-20 10:01:20 +02:00
Monty
93fb364cd9 Removed not used ha_drop_table()
This was done after changing call in sql_select.cc from
ha_drop_table() to drop_table(), like in 11.5
2024-11-20 09:59:43 +02:00
Monty
69be363daa Fixed that internal temporary Aria tables are not flushed to disk
This bug was caused by
MDEV-17070 Table corruption or Assertion `table->file->stats.records > 0
2024-11-19 20:27:51 +02:00
Monty
0de9e40f4b Added status variable "stack_usable" to be able to check stack usage 2024-11-19 19:02:45 +02:00
Alexander Barkov
ae0cbfe934 MDEV-28001 greatest/least with bigint unsigned maxium has unexpected results compared to 0
LEAST() and GREATEST() erroneously calcucalted the result as signed
for BIGINT UNSIGNED arguments.

Adding a new method for unsigned arguments:
  Item_func_min_max::val_uint_native()
2024-11-19 14:26:39 +04:00
Alexander Barkov
74184074a0 MDEV-28652 SUBSTRING(str,pos,len) returns incorrect result in view (returns an empty string)
Item_func_substr::fix_length_and_dec() incorrecltly calculated its max_length
to 0 when a huge number was passed as the third argument:
  substring('hello', 1, 4294967295)
Fixing this.
2024-11-19 12:35:00 +04:00
Alexander Barkov
09fe74c7fd MDEV-25174 DOUBLE columns do not accept large hex hybrids
Limit only signed integer fields fields to LONGLONG_MAX.
Double and decimal fields do not need this limit, as they
can store integers up to ULONGLONG_MAX without problems.
2024-11-19 11:50:12 +04:00
Alexander Barkov
70dbd63e02 MDEV-24337 Server crash in DTCollation::set_repertoire_from_charset
The loop in Item_func_in::get_func_mm_tree incorrectly used array->count
in the loop. Fixing it to array->used_count.
2024-11-19 10:57:14 +04:00
Julius Goryavsky
76fc26d632 galera SST scripts: correction of the grep pattern 2024-11-19 03:16:57 +01:00
Daniel Black
540288ac7c Fix URL in mariadb-install (no longer on launchpad)
Reviewer: Faustin
2024-11-19 08:48:40 +11:00
Daniel Black
1d6502b4f4 MDEV-34534 main.plugin_load(daemon_example) - AddressSanitizer: Joining already joined thread, aborting
Joining with a thread that has previously been joined results in undefined behavior.

This example plugin performs the same join to the same thread a few
lines later. ASAN keeps track of this and fails.

Make the behaviour defined by joining only once.

Thanks Vladislav Vaintroub for looking up the behaviour.

While here;
* init/deinit function argument was actually used.
* correct code comments
* attribute define not needed

Thanks Marko Mäkelä for review and suggesting other
fixes.
2024-11-18 22:35:40 +11:00
Alexander Barkov
b65504b8db MDEV-23138 Odd behavior of character_set variables set to utf16 (when allowed)
Sys_var_typelib did not work when assigned to an expression
with character sets with mbminlen>1.
Using val_str_ascii() instead of val_str() to fix this.
2024-11-18 11:34:13 +04:00
Sergey Vojtovich
ed72eadfb8 MDEV-35421 - main.mysql_upgrade fails without unix_socket plugin
Fixed main.mysql_upgrade to pass when unix_socket plugin is unavailable.

Also don't redefine _GNU_SOURCE, which was previously defined by command
line/environment. This fixes silent auth_socket build failure with
MYSQL_MAINTAINER_MODE=ERR.
2024-11-18 14:26:17 +11:00
Daniel Black
7f55c61060 Update Windows TZ data from unicode source (2024b) 2024-11-15 12:18:06 +11:00
Alexander Barkov
13a14c0d78 MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii
Item_func_boundary::val_str() did not set null_value when
it could not construct a geomery object from the input.
2024-11-14 13:27:22 +04:00
Vladislav Vaintroub
8a3c53f32b Connect engine - fix compiler error with MSVC 17.12
error C2664: 'bool TestHr(PGLOBAL,HRESULT)': cannot convert argument 2
from 'MSXML2::IXMLDOMNodePtr' to 'HRESULT'

Prior to 17.12, there was a code-analysis warning C6216 at the affected
places (compiler generated cast between semantically different integral
types).
2024-11-13 23:10:45 +01:00
Daniel Black
cad881ab10 MDEV-35088 main.timezone failing - MEST vs CET time zone difference
Reported in Debian bug #1084293, from the tzdata changelog:

  * Upstream obsoleted the System V names CET, CST6CDT, EET, EST*, HST, MET,
    MST*, PST8PDT, and WET. They are symlinks now. Move those zones to
    tzdata-legacy and update /etc/localtime on package update to the new names.
    Please use Etc/GMT* in case you want to avoid DST changes.

As such the timezone output started to output CET (or CEST) as the
current timezone. Due to the way the test was written, its only
possible to hit this error when running mtr from a package. The
internals of MTR fix the timezone so this will never be hit in a build.

As such, added Europe/Budapest as the Central Europe Standard Time
(per sql/win_tzname_data.h and its derived unicode.org source) as timezone,
hard fixed by timezone.opt file so it will always run. The
have_cet_timezone is there to check the zonedata is installed
(was absent on buildbot Ubuntu 22.04 and Windows).

As replace result to the CET output and treat MET/MEST as the
same while its on its way out.

Thanks Santiago Vila for the bug report and Otto for forwarding it.
2024-11-13 17:39:47 +11:00
Yuriy Kohut
ce3d0cd5b4 MDEV-35407 Suppress STDERR while determining rpm package vendor
... and version in %prein scriptlet

%prein(MariaDB-server-11.4.3-1.el9.x86_64) scriptlet failed, exit status 1

The message is:
"The current MariaDB server package is provided by a different vendor (warning: Signature not supported. Hash algorithm SHA1 not available. MariaDB Foundation)".

The "warning: Signature not supported. Hash algorithm SHA1 not available." is taken from the STDERR.

warning: Signature not supported. Hash algorithm SHA1 not available.
gpg-pubkey-73e3b907-6581b071

rpm package vendor and version should be grepped from STDIN only.

Reviewer: Daniel Black
2024-11-13 10:24:30 +11:00
Brandon Nesterenko
155a82e0b1 MDEV-35350: Backport search_pattern_in_file.inc SEARCH_WAIT to 10.5
MDEV-35350 consolidated two methods that MTR tests
would wait until a file had certain content
written to it, which were only available in 10.6+.
This patch only backports the functionality to
10.5 in case some test wants to use it (nothing
uses it in 10.5 at present).

The cleanup bc46f1a7d9 from 10.6 is also
backported so SEARCH_TYPE doesn't need to be
accounted for in the new search_pattern_in_file.inc
logic.
2024-11-12 05:54:50 -07:00
Hartmut Holzgraefe
a927e59e63 MDEV-34847 : Unquoted argument in {{logger}} call leads to invalid argument warnings
Make sure that even a quoted argument starting with '-' is not interpreted
as a command line option by adding '--' marker before message text
2024-11-12 21:14:03 +11:00
Hartmut Holzgraefe
1802785cc2 MDEV-34847 : Unquoted argument in {{logger}} call leads to invalid argument warnings
Added missing logger command argument quoting.

And fixed a wsrep_log call typo.
2024-11-12 21:14:03 +11:00
Yuchen Pei
df4b1349d9
fixup of MDEV-26345: make initialisation of a local bitmap earlier
This avoids freeing the map without initialisation.
2024-11-11 10:34:21 +11:00
Thirunarayanan Balathandayuthapani
7afee25b08 MDEV-35115 Inconsistent Replace behaviour when multiple unique index exist
- Replace statement fails with duplicate key error when multiple
unique key conflict happens. Reason is that Server expects the
InnoDB engine to store the confliciting keys in ascending order.
But the InnoDB doesn't store the conflicting keys
in ascending order.

Fix:
===
- Enable HA_DUPLICATE_KEY_NOT_IN_ORDER for InnoDB storage engine
only when unique index order is different in .frm and innodb dictionary.
2024-11-08 16:46:41 +05:30
Thirunarayanan Balathandayuthapani
98d57719e2 MDEV-32667 dict_stats_save_index_stat() reads uninitialized index->stats_error_printed
Problem:
========
- dict_stats_table_clone_create() does not initialize the
flag stats_error_printed in either dict_table_t or dict_index_t.
Because dict_stats_save_index_stat() is operating on a copy
of a dict_index_t object, it appears that
dict_index_t::stats_error_printed will always be false
for actual metadata objects, and uninitialized in
dict_stats_save_index_stat().

Solution:
=========
dict_stats_table_clone_create(): Assign stats_error_printed
for table and index while copying the statistics
2024-11-08 11:35:19 +05:30
Jan Lindström
4b38af06a4 MDEV-35157 : wrong binlog timestamps on secondary nodes of a galera cluster
Problem was missing thd->set_time() before binlog event
execution in wsrep_apply_events.

Removed part of earlier commit 1363580 because it had
nothing to do with VERSIONED tables.

Note that this commit does not contain mtr-testcase
because actual timestamps on binlog file depends the
actual time when events are executed and how long
their execution takes.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-06 04:59:10 +01:00
Julius Goryavsky
db68eb69f9 MDEV-35344: post-fix correction for other galera tests 2024-11-06 04:59:10 +01:00
Jan Lindström
e4a3a11dcc MDEV-35344 : Galera test failure on galera_sync_wait_upto
Ignoring configured server_id should not be a warning because
correct configuration is documented. Changed message to info
level with more detailed message what was configured and
what will be actually used.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-06 04:59:10 +01:00
Jan Lindström
eb891b6a95 MDEV-35345 : Galera test failure on MW-402
Add missing have_debug[_sync].inc include.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-06 04:59:09 +01:00
Denis Protivensky
6d5fe9ed0d MDEV-28378: Don't hang trying to peek log event past the end of log
While applying CTAS log event, we peek the relay log to see if CTAS
contains inserted rows or if it's empty.
The peek function didn't check for end-of-file condition when tried to
get the next event from the log, and thus it hanged.

The fix includes checking for end-of-file while peeking for log events
and considering returned XID_EVENT value as a sign of an empty CTAS.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-06 04:59:09 +01:00
Oleksandr Byelkin
ecdccddaae Merge branch '10.5' into mariadb-10.5.27 2024-11-04 07:35:28 +01:00
Daniel Bartholomew
2c42b24534
bump the VERSION 2024-11-01 11:13:09 -04:00
Vladislav Vaintroub
e147f8a5ed Fixup bddbef3573
For Windows, the method of finding stack limit is reportedly flaky,
and might not work as desired, as documented in
https://joeduffyblog.com/2006/07/15/checking-for-sufficient-stack-space

"Unfortunately, the StackLimit is only updated as you actually touch pages on
the stack, and thus it’s not a reliable way to find out how much
uncommitted stack is left."

Thus, Windows specific code was removed. It might be added, if we find out
that we need it, so far there was no need.

Also AIX, the code based on HAVE_PTHREAD_GETATTR_NP was found not to work,
(produce false positives of stack overrun), thus the traditional
fallback code is used.

Also
- removed repetitive fallback code
- fixed non-portable void pointer arithmethics (GCC-ism)
- took into account that pthread_attr_getstack() can fail,
- fixed the code for (less common) STACK_DIRECTION > 0.
- removed confusing/wrong comments about what "stack base address" means
  Single Unix Spec, AIX documentation make it clear what that is.
2024-10-31 10:01:01 +01:00