Commit graph

197596 commits

Author SHA1 Message Date
Michael Roosz
b5a54e8a93 MDEV-30321: blob data corrupted by row_merge_write_blob_to_tmp_file() 2023-01-04 16:21:07 +05:30
Marko Mäkelä
fe38d7cad4 Remove redundant statements from a test 2023-01-04 10:04:58 +02:00
Daniel Black
cfaf47a4d4 acl - is_public - avoid embedded warning
Using clang generates the unused-function warning on embedded like:

FAILED: libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_acl.cc.o
/usr/lib64/ccache/clang++ .... libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_acl.cc.o -MF libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_acl.cc.o.d -o libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_acl.cc.o -c /home/dan/repos/mariadb-server-10.11/sql/sql_acl.cc

sql_acl.cc:113:20: error: unused function 'is_public' [-Werror,-Wunused-function]
static inline bool is_public(const LEX_USER *l) { return is_public(&l->user); }
2023-01-04 08:24:05 +11:00
Monty
d0603fc5ba MDEV-30240 Wrong result upon aggregate function with SQL_BUFFER_RESULT
The problem was that when storing rows into a temporary table,
MIN/MAX items that where marked as constants (as theire value had
been computed at start of query) would be reset.

Fixed by not reseting MIN/MAX items that are marked as const in
Item_sum_min_max::clear().
2023-01-03 19:44:19 +02:00
Marko Mäkelä
e441c32a0b Merge 10.5 into 10.6 2023-01-03 18:13:11 +02:00
Marko Mäkelä
8b9b4ab3f5 Merge 10.4 into 10.5 2023-01-03 17:08:42 +02:00
Marko Mäkelä
fb0808c450 Merge 10.3 into 10.4 2023-01-03 16:10:02 +02:00
Sergei Golubchik
c6e0ab74f0 bump the VERSION 2023-01-03 10:43:51 +01:00
Oleksandr Byelkin
22491e627a MDEV-30154: Assertion `strcasecmp(rolename, public_name.str) || acl_public == role' failed in acl_update_role on GRANT ... TO PUBLIC
Reset of acl_public was made too early (before saving it to restore in case
of error).
2023-01-03 10:17:42 +01:00
Daniel Black
a5be6c91cb MDEV-29889 mariadb-dump --tab --header is slow
--header applied an ORDER BY to ensure that the header
row was the first row in the output given UNION ALL
doesn't in the standard enforce the order.

We change that now only add the ORDER BY if --order-by-primary
is used.

An assumption that if UNION ALL change to a different behaviour
the resulting mysqldump-header test may also change.
2023-01-03 14:57:02 +11:00
Andrew Hutchings
e51a1d6fc0 MDEV-30329: mariadb-service-convert resets systemd service to default User=root
If mariadb-service-convert is run and the user variable is unset then
this sets `User=` in `[Service]`, which then tries to run mariadb as
root, which in-turn fails. This only happens when mysqld_safe is missing
which is all the time now. So don't set `User=` if there is no user variable.

Reviewer: Sergei Golubchik <serg@mariadb.org> (in PR #2382)
2023-01-03 11:45:24 +11:00
Daniel Black
c4938eafc5 MDEV-30275: mariadb names rather than mysql names should be used
* mariadb-service-convert to use mariadbd-safe
* galera_recovery to use mariadbd
* mtr - wsrep use mariadb executables
* debian/mariadb-server.mariadb.init use mariadbd-safe
* debian/tests/smoke uses mariadb instead of mysql as client.

Co-Author: Daniel Black <daniel@mariadb.org>
2023-01-03 11:25:10 +11:00
Alexander Kuleshov
fd6f19d732 Fix a typo in CmakeLists.txt 2023-01-03 08:47:08 +11:00
Sergei Golubchik
8760f6907c MDEV-30102 file missing in development libraries
move mariadb_capi_rename.h out of private server headers,
because it's included by mysql.h which is not private.
2023-01-02 00:04:03 +01:00
Sergei Golubchik
21223c0461 MDEV-29988 group by fix 2023-01-02 00:04:03 +01:00
Sergei Golubchik
ca23558a05 --skip-name-resolve=0 didn't work
custom code in `case OPT_SKIP_RESOLVE`
was overriding the correct value from handle_options().
2023-01-02 00:04:03 +01:00
Sergei Golubchik
908c48a34d fixes for json.json_table and main.func_json in --ps 2023-01-02 00:04:03 +01:00
Sergei Golubchik
d78ac04ee6 ignore changes in submodules when committing everything
covers `git commit -a` and `git citool` (`git add`, `git status`, etc).
they can still be added explicitly
2023-01-02 00:04:03 +01:00
Oleksandr Byelkin
60f646e2f3 MDEV-29988: (spider fix) Major performance regression with 10.6.11
Make Item_direct_ref_to_item transparent for Spider
2023-01-02 00:04:03 +01:00
Sergei Golubchik
eba099184e MDEV-30151 parse error 1=2 not between/in
the parser couldn't parse `1=2 not between 3 and 5`
after `2` it expected only NOT2_SYM, but not NOT_SYM
(visible from the sql_yacc.output file), which resulted in
Syntax error ... near 'not between 3 and 4'

The parser was confused by a rather low NOT_SYM precedence and
%prec BETWEEN_SYM didn't resolve this confusion.

As a fix, let's remove any %precedence from NOT_SYM and
specify %prec explicitly in the only place where it matters for NOT_SYM.

In other places, such as for NOT BETWEEN, NOT_SYM won't have a
precedence, so bison won't be confused about it.
2023-01-02 00:04:03 +01:00
Dmitry Shulga
37a316c01d MDEV-29988: Major performance regression with 10.6.11
The idea is to put Item_direct_ref_to_item as a transparent and
permanent wrapper before a string which require conversion.
So that Item_direct_ref_to_item would be the only place where
the pointer to the string item is stored, this pointer can be changed
and restored during PS execution as needed. And if any permanent
(subquery) optimization would need a pointer to the item,
it'll use a pointer to the Item_direct_ref_to_item - which is
a permanent item and won't go away.
2023-01-02 00:04:03 +01:00
Sergei Golubchik
f8adc47b69 MDEV-19071 Wrong results when using STDDEV_SAMP() and view 2023-01-02 00:04:03 +01:00
Dmitry Shulga
a9b31b0814 MDEV-29988: (revert) Major performance regression with 10.6.11
Reverted changed in server code introduced by
the commit bd9274faa4.
Tests from this commit are retained.
2023-01-02 00:04:03 +01:00
Julius Goryavsky
6710fe4b42 MDEV-30293: mariabackup fail with --galera-info option without Galera
Without Galera, mariabackup should ignore the --galera-info option
and not fail with rc != 0 like it does now. This commit fixes this flaw.
2022-12-27 14:16:15 +01:00
Marko Mäkelä
72e2d1d220 MDEV-25004 Refactorings
* Avoid some pessimization
  * Slightly smaller upgrade dataset
  * Simplify vers_row_same_trx() and its caller
2022-12-27 00:02:02 +03:00
Aleksey Midenkov
e056efdd6c MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
1. In case of system-versioned table add row_end into FTS_DOC_ID index
   in fts_create_common_tables() and innobase_create_key_defs().
   fts_n_uniq() returns 1 or 2 depending on whether the table is
   system-versioned.

   After this patch recreate of FTS_DOC_ID index is required for
   existing system-versioned tables. If you see this message in error
   log or server warnings: "InnoDB: Table db/t1 contains 2 indexes
   inside InnoDB, which is different from the number of indexes 1
   defined in the MariaDB" use this command to fix the table:

      ALTER TABLE db.t1 FORCE;

2. Fix duplicate history for secondary unique index like it was done
   in MDEV-23644 for clustered index (932ec586aa). In case of
   existing history row which conflicts with currently inseted row we
   check in row_ins_scan_sec_index_for_duplicate() whether that row
   was inserted as part of current transaction. In that case we
   indicate with DB_FOREIGN_DUPLICATE_KEY that new history row is not
   needed and should be silently skipped.

3. Some parts of MDEV-21138 (7410ff436e) reverted. Skipping of
   FTS_DOC_ID index for history rows made problems with purge
   system. Now this is fixed differently by p.2.

4. wait_all_purged.inc checks that we didn't affect non-history rows
   so they are deleted and purged correctly.

Additional FTS fixes

  fts_init_get_doc_id(): exclude history rows from max_doc_id
  calculation. fts_init_get_doc_id() callback is used only for crash
  recovery.

  fts_add_doc_by_id(): set max value for row_end field.

  fts_read_stopword(): stopwords table can be system-versioned too. We
  now read stopwords only for current data.

  row_insert_for_mysql(): exclude history rows from doc_id validation.

  row_merge_read_clustered_index(): exclude history_rows from doc_id
  processing.

  fts_load_user_stopword(): for versioned table retrieve row_end field
  and skip history rows. For non-versioned table we retrieve 'value'
  field twice (just for uniformity).

FTS tests for System Versioning now include maybe_versioning.inc which
adds 3 combinations:

'vers'     for debug build sets sysvers_force and
	   sysvers_hide. sysvers_force makes every created table
	   system-versioned, sysvers_hide hides WITH SYSTEM VERSIONING
	   for SHOW CREATE.

	   Note: basic.test, stopword.test and versioning.test do not
	   require debug for 'vers' combination. This is controlled by
	   $modify_create_table in maybe_versioning.inc and these
	   tests run WITH SYSTEM VERSIONING explicitly which allows to
	   test 'vers' combination on non-debug builds.

'vers_trx' like 'vers' sets sysvers_force_trx and sysvers_hide. That
	   tests FTS with trx_id-based System Versioning.

'orig' 	   works like before: no System Versioning is added, no debug is
	   required.

Upgrade/downgrade test for System Versioning is done by
innodb_fts.versioning. It has 2 combinations:

'prepare' makes binaries in std_data (requires old server and OLD_BINDIR).
	  It tests upgrade/downgrade against old server as well.

'upgrade' tests upgrade against binaries in std_data.

Cleanups:

Removed innodb-fts-stopword.test as it duplicates stopword.test
2022-12-27 00:02:02 +03:00
Aleksey Midenkov
68c437bad6 MDEV-25004 restart_bindir option to restart server from different location
Adds new parameter $restart_bindir for restart_mysqld.inc.

Example:

let $restart_bindir= /home/midenok/src/mariadb/10.3b/build;
--source include/restart_mysqld.inc

It is good to return back original server before check_mysqld will be
run at the test end:

let $restart_bindir=;
--source include/restart_mysqld.inc
2022-12-27 00:02:01 +03:00
Aleksey Midenkov
5d506ac201 MDEV-25004 vers_force_trx option to force transactional System Versioning
Works like vers_force but forces trx_id-based system-versioned tables
if the storage supports it (currently InnoDB-only). Otherwise creates
timestamp-based system-versioned table.
2022-12-27 00:02:01 +03:00
Sergei Golubchik
fce80b6ae1 sporadic failures of perfschema.statement_program_concurrency
wait until all three concurrent statements are truly completely
finished before quering P_S.

In particular "Logging slow query" stage happens after sending the
OK packet but before the statement appears in events_statements_history
2022-12-24 18:53:16 +01:00
Sergei Golubchik
5e3c948cc9 MDEV-29852 SIGSEGV in mysql_create_routine or is_acl_user on 2nd execution, ASAN use-after-poison in get_current_user (sql_acl.cc)
if lex->definer is replaced, take care to restore it at the
end of PS EXECUTE
2022-12-24 16:13:50 +01:00
Yuchen Pei
1be861c582
MDEV-28526 Spider: remove conn_kind member variables
The conn_kind, which stands for "connection kind", is no longer useful
because the HandlerSocket support is deleted and Spider now has only
one connection kind, SPIDER_CONN_KIND_MYSQL. Remove conn_kind and
related code.

Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: Nayuta Yanagisawa <nayuta.yanagisawa@mariadb.com>
2022-12-23 17:58:51 +11:00
Yuchen Pei
1128b54aa4
MDEV-29269 Spider: remove #ifdef ITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC
Produced using the following command

unifdef -UITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC -m storage/spider/spd_*

Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: nayuta.yanagisawa@mariadb.com
2022-12-23 17:33:43 +11:00
Yuchen Pei
9c05c840b4
MDEV-28891 Spider: remove #ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
unifdef -DSPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR -m
storage/spider/*.{cc,h}

and removing the definition manually.

Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: Nayuta Yanagisawa <nayuta.yanagisawa@mariadb.com>
2022-12-23 16:17:46 +11:00
Marko Mäkelä
4493642e4c MDEV-29562 fixup: ASAN global-buffer-overflow
ha_spider::create(): Pass the correct length of the argument of the
CHARSET attribute. The macro STRING_WITH_LEN() is intended to be used
with NUL terminated string constants only. Here, it would incorrectly
pass sizeof(char*)-1 as the length.
2022-12-22 12:47:45 +02:00
Yuchen Pei
fb41117c90
MDEV-29653 Make sure Item_cache_row has the correct type handler.
The incorrect type handler caused an incorrect result_type() for
Item_cache_row (STRING_RESULT rather than ROW_RESULT). By updating the
constructor of Item_cache_row with the correct type handler, it fixes
this problem.

Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: Sergei Golubchik <serg@mariadb.com>
2022-12-22 12:49:04 +11:00
Sergei Golubchik
66f7f7998c fix failing galera test 2022-12-21 12:49:58 +01:00
Marko Mäkelä
5cec83476d MDEV-29896: mariadb-backup --backup --incremental --throttle=... hangs
io_watching_thread(): Declare as a detachable thread, similar to
log_copying_thread().

stop_backup_threads(): Wait for both log_copying_thread and
io_watching_thread to clear their flags. Expect log_sys.mutex
to be held by the caller.

xtrabackup_backup_func(): Initialize log_copying_stop before
creating io_watching_thread. This prevents a race condition
where io_watching_thread() could wait on the condition variable
before it had been fully initialized. This race condition would
cause a hang in the GNU libc implementation of pthread_cond_destroy()
at the end of stop_backup_threads().

This race condition was introduced in
commit 38fd7b7d91 (MDEV-21452).
2022-12-21 13:41:10 +02:00
musvaage
7c5609fb64 typos 2022-12-21 12:46:52 +11:00
Yuchen Pei
5eb545e5c2
MDEV-29562 Spider table charset error should happen correctly.
When trying to create a spider table with banned charsets including
utf32, utf16, ucs2 and utf16le[1], spider should emit an error
immediately, rather than wait until a separate statement that
establishes a connection (e.g. SELECT). This also applies to ALTER
TABLE statement that changes charsets.

[1] https://mariadb.com/kb/en/server-system-variables/#character_set_client

Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: Nayuta Yanagisawa <nayuta.yanagisawa@mariadb.com>
2022-12-21 11:45:23 +11:00
Sergei Golubchik
b1856aff37 mark an unused error message 2022-12-20 22:45:08 +01:00
Monty
65683807e9 Fixed usage of unitialised value error in test_sql_service
This caused valgrind errors when using plugins.test_sql_service
2022-12-20 22:34:53 +02:00
Sergei Golubchik
681976ed14 spider fixes for 11.0+
spider_rewrite plugin is not in 11.0. spider initialization code used
"11.0" for "in the distant future", but suddenly it's now

spider tests didn't expect anything beyond 10.x
2022-12-20 16:02:19 +01:00
Sergei Golubchik
71a72dd770 11.0 branch 2022-12-20 16:02:19 +01:00
Robin Newhouse
76c2402812 Fix build failure in sanitizer on GitLab-CI
Sanitizer tests were introduced in 617f45b for GitLab CI, but started
failing on latest Fedora version with error:

    $ yum install -y /usr/lib64/libasan.so.6.0.0 /usr/lib64/libtsan.so.0.0.0 /usr/lib64/libubsan.so.1.0.0
    Last metadata expiration check: 0:00:51 ago on Fri Dec  9 20:05:01 2022.
    No match for argument: /usr/lib64/libasan.so.6.0.0
    No match for argument: /usr/lib64/libtsan.so.0.0.0
    Error: Unable to find a match: /usr/lib64/libasan.so.6.0.0 /usr/lib64/libtsan.so.0.0.0

The reason for using specific library versions is unknown. Switch to
simply using latest package versions, as is works and is likely to work
best in the long run.

Also, enclose "../rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log" in
quotes to avoid `ambiguous redirect` error when $CI_JOB_NAME has spaces.

Additionally use "needs" statements to allow tests to run immediately
after dependent jobs passed instead of waiting for the full stage to
complete.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the BSD-new
license. I am contributing on behalf of my employer Amazon Web Services
2022-12-20 13:27:50 +00:00
Vlad Lesin
3ddc00dc3b MDEV-30225 RR isolation violation with locking unique search
Before the fix next-key lock was requested only if a record was
delete-marked for locking unique search in RR isolation level.
There can be several delete-marked records for the same unique key,
that's why InnoDB scans the records until eighter non-delete-marked record
is reached or all delete-marked records with the same unique key are
scanned.

For range scan next-key locks are used for RR to protect scanned range from
inserting new records by other transactions. And this is the reason of why
next-key locks are used for delete-marked records for unique searches.

If a record is not delete-marked, the requested lock type was "not-gap".
When a record is not delete-marked during lock request by trx 1, and
some other transaction holds conflicting lock, trx 1 creates waiting
not-gap lock on the record and suspends. During trx 1 suspending the
record can be delete-marked. And when the lock is granted on conflicting
transaction commit or rollback, its type is still "not-gap". So we have
"not-gap" lock on delete-marked record for RR. And this let some other
transaction to insert some record with the same unique key when trx 1 is
not committed, what can cause isolation level violation.

The fix is to set next-key locks for both delete-marked and
non-delete-marked records for unique search in RR.
2022-12-20 11:31:49 +03:00
Yuchen Pei
3f63aa18a7
MDEV-29562 Spider table charset error should happen correctly.
When trying to create a spider table with banned charsets including
utf32, utf16, ucs2 and utf16le[1], spider should emit an error
immediately, rather than wait until a separate statement that
establishes a connection (e.g. SELECT). This also applies to ALTER
TABLE statement that changes charsets.

[1] https://mariadb.com/kb/en/server-system-variables/#character_set_client

Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: Nayuta Yanagisawa <nayuta.yanagisawa@mariadb.com>
2022-12-20 13:08:49 +11:00
musvaage
c21566a78a header typos 2022-12-20 10:23:42 +11:00
musvaage
6d6e721b60 header typo 2022-12-20 10:18:56 +11:00
musvaage
84539f6460 header typo 2022-12-20 09:49:20 +11:00
musvaage
e9e6c7a3c5 header typos 2022-12-20 08:55:48 +11:00