Commit graph

195691 commits

Author SHA1 Message Date
Rucha Deodhar
95a9078efc MDEV-28071: JSON_EXISTS returns always 1 if it is used range notation for
json path
Analysis: When searching for the given path in json string, if the current
step is of array range type, then path was considered reached which meant
path exists. So output was always true. The end indexes of range were not
evaluated.
Fix: If the current step type for a path is array range, then check if the
value array_counter[] is in range of n_item and n_item_end. If it is, then
path exists. Only then return true. If the range criteria is never met
then return false.
2022-04-15 01:04:25 +05:30
Rucha Deodhar
e6511a39f8 vcol.wrong_arena failing on buildbot when current date is '2022-03-17'
Analysis: When current date is '2022-03-17', dayname() gives 'Thursday'. The
previous json state is PS_KEYX which means key started with quote.
So now json parser for path is supposed to parse the key.
The keyname starts with 'T'. But the path transition table has JE_SYN when
previous state is PS_KEYX and next letter is 'T'. So it gives error.
Fix: We want to continue parsing the quoted keyname. So JE_SYN is incorrect.
Replaced it with PS_KNMX.
2022-04-15 01:02:44 +05:30
Rucha Deodhar
c781cefd8a MDEV-27911: Implement range notation for json path
Range can be thought about in similar manner as wildcard (*) where
more than one elements are processed. To implement range notation, extended
json parser to parse the 'to' keyword and added JSON_PATH_ARRAY_RANGE for
path type. If there is 'to' keyword then use JSON_PATH_ARRAY range for
path type along with existing type.
This new integer to store the end index of range is n_item_end.
When there is 'to' keyword, store the integer in n_item_end else store in
n_item.
2022-04-15 01:02:44 +05:30
Nayuta Yanagisawa
cc13ab0ffc MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
Deprecate the variables spider_crd_type and spider_crd_weight.
The value should be defined by the engine developers.
2022-04-14 23:41:16 +09:00
Nayuta Yanagisawa
075c94fe2b MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
The variables, spider_crd_mode and spider_sts_mode, specify the
ways to fetch statistics from data nodes.

Using the SHOW command seems to work for any cases. Thus, we deprecate
the variables.
2022-04-14 23:39:42 +09:00
Nayuta Yanagisawa
7310e93ef6 MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
Deprecate the following variables:

* spider_store_last_crd
* spider_store_last_sts
* spider_load_crd_at_startup
* spider_load_sts_at_startup
2022-04-14 23:33:24 +09:00
Nayuta Yanagisawa
3be8f66185 MDEV-28244 Deprecate spider_xa_register_mode
We deprecate the variable spider_xa_register_mode because there is
no need to perform a two phase commit for a read-only transaction.

Note that the variable only affects Spider's internal XA transactions.
2022-04-14 23:31:15 +09:00
Marko Mäkelä
c235295525 Merge 10.6 into 10.7 2022-04-14 13:31:07 +03:00
Alexander Barkov
83516a33a8 An additional patch for MDEV-27690 Crash on CHARACTER SET csname COLLATE DEFAULT in column definition
Applying the fix to sql_yacc_ora.yy. Adding a test for sql_mode=ORACLE.
2022-04-14 12:22:28 +04:00
Alexander Barkov
9d734cdd61 Merge remote-tracking branch 'origin/10.2' into 10.3 2022-04-14 11:50:34 +04:00
Marko Mäkelä
2aed566d22 Cleanup: alignas(CPU_LEVEL1_DCACHE_LINESIZE)
Let us replace all use of MY_ALIGNED in InnoDB with C++11 alignas.

CACHE_LINE_SIZE: Replaced with CPU_LEVEL1_DCACHE_LINESIZE.
2022-04-14 10:40:26 +03:00
Marko Mäkelä
03f9bb8c90 MDEV-28313: Shrink ReadView::m_mutex
A few PERFORMANCE_SCHEMA instrumentation keys were not exposed
in all_innodb_mutexes[]. Let us remove them.

The keys fts_pll_tokenize_mutex_key and read_view_mutex_key were
internally used. Let us make ReadView::m_mutex use the simpler
and smaller srw_mutex, hoping to improve memory access patterns.
2022-04-14 10:21:43 +03:00
Marko Mäkelä
8074ab5784 MDEV-28313: Shrink rw_trx_hash_element_t::mutex
The element mutex is unnecessarily large. The PERFORMANCE_SCHEMA
instrumentation was not even enabled.
2022-04-14 10:10:44 +03:00
Marko Mäkelä
0cd2e6c614 MDEV-28313: InnoDB transactions are not aligned at cache lines
trx_lock_t: Remove byte pad[256] and use
alignas(CPU_LEVEL1_DCACHE_LINESIZE) instead.

trx_t: Declare n_ref (the first member) aligned at cache line.

Pool: Assert that the sizes are multiples of
CPU_LEVEL1_DCACHE_LINESIZE, and invoke an aligned allocator.
2022-04-14 10:06:34 +03:00
Sergei Golubchik
f7f0bc748e cleanup: un-inline dtype_get_mblen()
per Marko request
2022-04-13 17:50:00 +02:00
Sergei Golubchik
fc8396448c MDEV-27767 poor scaling with InnoDB and utf8mb3 because of charset stats
Access the all_charsets[] array directly in a hot loop.
This avoids get_charset() that increments a shared counter via
my_collation_statistics_inc_use_count(), causing a scalability issue.

Instead, call get_charset() when a table is opened (and InnoDB
fills in dtype_t values) - this is enough, as charset is marked
ready (MY_CS_READY) only once, on the first get_charset() call,
after that it can be accessed directly.

This also fixes a potential bug in InnoDB. It used to access charsets
directly when filling dtype_t values. This wasn't preceded by any
get_charset() call inside InnoDB. Normally the server would call
get_charset() on reading the frm, but if the table was first opened
from a purge thread InnoDB could, theoretically, access a not-ready
charset in innobase_get_cset_width().
2022-04-13 17:50:00 +02:00
Rucha Deodhar
abe9712194 MDEV-27972: Unexpected behavior with negative zero (-0) in
JSON Path

Analysis: When we have '-' followed by 0, then the state is
changed to JE_SYN, meaning syntax error.
Fix: Change the state to PS_INT instead, because we are
reading '0' next (integer) and it is not a syntax error.
2022-04-13 21:16:32 +05:30
Rucha Deodhar
dfcbb30a92 MDEV-22224: Support JSON Path negative index
This patch can be viewed as combination of two parts:
1) Enabling '-' in the path so that the parser does not give out a warning.
2) Setting the negative index to a correct value and returning the
   appropriate value.

1) To enable using the negative index in the path:
To make the parser not return warning when negative index is used in path
'-' needs to be allowed in json path characters. P_NEG is added
to enable this and is made recognizable by setting the 45th index of
json_path_chr_map[] to P_NEG (instead of previous P_ETC)
because 45 corresponds to '-' in unicode.
When the path is being parsed and '-' is encountered, the parser should
recognize it as parsing '-' sign, so a new json state PS_NEG is required.
When the state is PS_NEG, it means that a negative integer is
going to be parsed so set is_negative_index of current step to 1 and
n_item is set accordingly when integer is encountered after '-'.
Next proceed with parsing rest of the path and get the correct path.
Next thing is parsing the json and returning correct value.

2) Setting the negative index to a correct value and returning the value:
While parsing json if we encounter array and the path step for the array
is a negative index (n_item < 0), then we can count the number of elements
in the array and set n_item to correct corresponding value. This is done in
json_skip_array_and_count.
2022-04-13 21:16:32 +05:30
Oleksandr Byelkin
f130a5ea3c MDEV-28266 Crash in Field_string::type_handler when calling procedures
on_table_fill_finished() should always be done at the end of open()
even if result is not Select_materialize but (for example)
Select_fetch_into_spvars.
2022-04-13 15:37:46 +02:00
Oleksandr Byelkin
5615a78a69 MDEV-28266 Crash in Field_string::type_handler when calling procedures
on_table_fill_finished() should always be done at the end of open()
even if result is not Select_materialize but (for example)
Select_fetch_into_spvars.
2022-04-13 15:11:59 +02:00
Marko Mäkelä
e98013cb5c Merge 10.8 into 10.9 2022-04-13 13:39:00 +03:00
Nayuta Yanagisawa
cbf9d8a8d5 Merge 10.7 into 10.8 2022-04-13 17:52:27 +09:00
Marko Mäkelä
e4835bf572 MDEV-28304 innodb.instant_alter,8k.rdiff does not apply on FreeBSD
This is conceptually a backport of
commit 6f4740fde7
(re-recording the .rdiff files).
2022-04-13 09:23:52 +03:00
KiyoshiTakeda
e87c710dfc
MDEV-27981 Deprecate spider_internal_limit
The variable spider_internal_limit is for specifying the number of
records acquired by Spider from each remote server. 

There seems not to be much use of the variable. Thus, we deprecate it
and the corresponding table options. 

Reviewed-by: Nayuta Yanagisawa <nayuta.yanagisawa@hey.com>
2022-04-13 15:21:15 +09:00
Daniel Black
bea47a6f59 MDEV-27791: rocksdb_log_dir test postfix
We can only remove a subdirectory in mtr on an installed instance

Example failure previously:

CURRENT_TEST: rocksdb.rocksdb_log_dir
mysqltest: At line 15: Path '/usr/local/mariadb-10.9.0-linux-systemd-x86_64/mysql-test/var/tmp/1' is not a subdirectory of MYSQLTEST_VARDIR '/usr/local/mariadb-10.9.0-linux-systemd-x86_64/mysql-test/var/1'or MYSQL_TMP_DIR '/usr/local/mariadb-10.9.0-linux-systemd-x86_64/mysql-test/var/tmp/1'
2022-04-13 15:46:56 +10:00
Xinyi Hong
1ac87d6dd4 MDEV-27791: Create a new MyRocks parameter rocksdb_log_dir
Parameter rocksdb_log_dir specifies the path of MyRocks error logs.

By default, the error logs are stored in the same folder with MyRocks
redo logs. Being able to put human readable logs in one place and
machine logs in another place improves usability.

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, Inc.
2022-04-13 08:36:33 +10:00
Julius Goryavsky
42908dc5fb MDEV-26171: wsrep_sst_receive_address does not parse IPv6 address correctly
This commit fixes problems with parsing ipv6 addresses given via
the wsrep_sst_receive_address and wsrep_node_address options.

Also, this commit removes extra lines in the configuration files
in the mtr test suites for Galera related to these parameters.
2022-04-12 17:14:39 +02:00
Marko Mäkelä
aa3a9d1ef5 Merge 10.6 into 10.7 2022-04-12 16:11:29 +03:00
Marko Mäkelä
cdc0bbdd87 Merge 10.5 into 10.6 2022-04-12 14:53:58 +03:00
Sergei Golubchik
d31732e02e MDEV-27834 Incorrect provides of MariaDB-shared for CentOS8
fix bad merge
2022-04-12 13:38:41 +02:00
Sergei Golubchik
bbdec04d59 MDEV-24317 Data race in LOGGER::init_error_log at sql/log.cc:1443 and in LOGGER::error_log_print at sql/log.cc:1181
don't initialize error_log_handler_list in set_handlers()
* error_log_handler_list is initialized to LOG_FILE early, in init_base()
* set_handlers always reinitializes it to LOG_FILE, so it's pointless
* after init_base() concurrent threads start using sql_log_warning,
  so following set_handlers() shouldn't modify error_log_handler_list
  without some protection
2022-04-12 13:07:20 +02:00
Alexander Barkov
e41500e4f2 MDEV-26128 type_set and type_enum are broken
The problem was not with the server behavior,
it was with wrong test results recorded.

Enabling both type_set and type_enum.

type_set.result was OK. The test did not fail.

type_enum.result was incorrectly recorded in this commit:
  eb483c5181

Recording correct results.
2022-04-12 14:26:02 +04:00
Thirunarayanan Balathandayuthapani
011b332d81 MDEV-28037 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned
- Trigger statement initiate update statement after bulk insert
operation and leads to disable of bulk operation. During commit,
InnoDB expects transaction to be in bulk insert mode before
applying the bulk insert operation. InnoDB transaction should
apply all bulk insert operation before disabling bulk insert
operation.
2022-04-12 14:41:11 +05:30
Monty
ef8d203a31 Added scripts/wsrep_sst_backup to .gitignore 2022-04-12 11:33:52 +03:00
Monty
22f7190e85 MDEV-28074 mysqldump --order-by-size
Author: Erki Aring
2022-04-12 11:32:02 +03:00
Marko Mäkelä
c5512878fe MDEV-14425 fixup: Fix a typo in mariadb-backup 2022-04-12 10:27:18 +03:00
Marko Mäkelä
ca3bbf4c0c Merge 10.5 into 10.6 2022-04-12 09:26:02 +03:00
Tuukka Pasanen
bc75f7ed6d MDEV-28194: Remove unneeded path from MariaDB server postinst script
Remove unndeeded paths from mariadb-server-10.6.postinst as
it's already in export PATH and it fires 'command-with-path-in-maintainer-script'
in lintian checks
2022-04-12 13:28:30 +10:00
Shunpoco
767d8d8335 MDEV-27448 MTR returns success (zero) upon invalid option
I change from `exit;` to `exit(1);` on a function `usage()`.
When we try to run mtr with a wrong option, a function `usage()` is called with the wrong option as its argument. In this case, because the function call `exit` in a first if statement, we get exit status 0.
2022-04-12 08:17:32 +10:00
Tuukka Pasanen
e858fc89d3 MDEV-27033: Clean lintian 'duplicate-override-context' warnings
Fix Debian lintian warnings:
  W: mariadb-10.7 source: duplicate-override-context version-substvar-for-external-package (lines 12 13) [debian/source/lintian-overrides:13]
  W: mariadb-10.7 source: duplicate-override-context version-substvar-for-external-package (lines 14 15) [debian/source/lintian-overrides:15]
  W: mariadb-10.7 source: duplicate-override-context version-substvar-for-external-package (lines 16 17) [debian/source/lintian-overrides:17]
  W: mariadb-10.7 source: duplicate-override-context version-substvar-for-external-package (lines 18 19) [debian/source/lintian-overrides:19]
  W: mariadb-10.7 source: duplicate-override-context version-substvar-for-external-package (lines 20 21) [debian/source/lintian-overrides:21]
  W: mariadb-10.7 source: duplicate-override-context version-substvar-for-external-package (lines 4 5) [debian/source/lintian-overrides:5]
by removing duplicate override lines
2022-04-12 08:16:09 +10:00
Rucha Deodhar
3327bb6098 MDEV-22266: Diagnostics_area::sql_errno() const: Assertion
`m_status == DA_ERROR' failed on SELECT after setting tmp_disk_table_size.

Analysis: Mismatch in number of warnings between "194 warnings" vs
"64 rows in set" is because of max_error_count variable which has default
value of 64.
About the corrupted tables, the error that occurs because of insufficient
tmp_disk_table_size variable is not reported correctly and we continue to
execute the statement. But because the previous error (about table being
full)is not reported correctly, this error moves up the stack and is
wrongly reported as parsing error later on while parsing frm file of one
of the information schema table. This parsing error gives corrupted table
error.
As for the innodb error, it occurs even when tmp_disk_table_size is not
insufficient is default but the internal error handler takes care of it
and the error doesn't show. But when tmp_disk_table_size is insufficient,
the fatal error which wasn't reported correctly moves up the stack so
internal error handler is not called. So it shows errors.
Fix: Report the error correctly.
2022-04-12 01:22:51 +05:30
Alexander Barkov
833f4486cf MDEV-27690 Crash on CHARACTER SET csname COLLATE DEFAULT in column definition
This is a temporary fix for 10.2.
This problem was permanently fixed in 10.9 under terms of MDEV-27743.

This patch should propagate up to 10.8 then null-merged to 10.9.
2022-04-11 19:45:31 +04:00
Monty
6891c4874a MDEV-28269 Assertion `save_errno' in maria_write or ER_GET_ERRNO
The issue was that the value of MARIA_FOUND_WRONG_KEY was a value
that could be returned by ha_key_cmp.

This was already fixed in MyISAM, now using the same fix in Aria:
Setting the value to INT_MAX32, which should be impossible in any
normal cases.

I also fixed so that if there is a wrong key, we now get a proper error
message and not an assert.
2022-04-11 17:30:28 +03:00
Thirunarayanan Balathandayuthapani
f61f58e759 MDEV-26578 ERROR: AddressSanitizer: heap-use-after-free around dict_table_t::is_temporary_name
- Purge thread is trying to access the table name when other thread
does rename of the table name. It leads to heap use after free error
by purge thread. purge thread should check whether the table name
is temporary while holding dict_sys.mutex.
2022-04-11 19:59:01 +05:30
KiyoshiTakeda
4d1955d348
MDEV-28225 Disallow user to create Spider temporary table
Creating a temporary table with Spider is non-sense because a Spider
table cannot hold any physical data and it requires an additional
effort to manage even if it is configured correctly.

Set HTON_TEMPORARY_NOT_SUPPORTED to spider_hton->flags.  

Reviewed-by: nayuta.yanagisawa@hey.com
Co-authored-by: d8sk4ueun@gmail.com
2022-04-11 23:02:38 +09:00
Marko Mäkelä
840bab858b MDEV-28289 fts_optimize_sync_table() is acquiring dict_sys.latch while holding it
dict_acquire_mdl_shared(): Invoke the correct variant
dict_table_t::parse_name<true>() also when trylock=true,
that is, we are being called from fts_optimize_sync_table().

Ever since commit 82b7c561b7 (MDEV-24258)
this code was prone to a hang. If another thread requested an
exclusive dict_sys.latch between the time
dict_acquire_mdl_shared<trylock=true>() acquired a shared dict_sys.latch
and dict_table_t::parse_name<false>() was trying to acquire another
shared dict_sys.latch, InnoDB would get into an infinite livelock
of threads, because the futex-based srw-lock implementation prioritizes
exclusive latch requests.

dict_table_t::parse_name(): Rename the template parameter dict_locked
into dict_frozen.
2022-04-11 14:41:24 +03:00
Marko Mäkelä
7bccf3dd74 MDEV-28274 Assertion s <= READ_FIX failed in buf_page_t::set_state
buf_page_t::set_state(): Relax a debug assertion. It is fine to update
a read-fixed block descriptor to be both read-fixed and buffer-fixed.

buf_pool_t::watch_unset(): Fix some incorrect logic that was implemented
in commit e9e6db9355.

Thanks to Elena Stepanova for the test case.
2022-04-11 10:22:40 +03:00
Vladislav Vaintroub
5a4a37076d MDEV-10183 implement service_manager_extend_timeout on Windows
The implementation calls SetServiceStatus() with updated
SERVICE_STATUS::dwHint and SERVICE_STATUS::dwCheckpoint
2022-04-11 07:49:43 +02:00
Alexander Barkov
bf70532e3d 10.5 tests for MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed
The fix for MDEV-27673 (in 10.3) fixed MDEV-26507 as well.
This patch only adds MTR tests.
2022-04-10 15:28:35 +04:00
Alexander Barkov
284ff64cd6 10.6 tests for MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed
The patch for MDEV-27673 (in 10.3) fixed MDEV-26507 as well.

This patch only adds 10.6 specific MTR tests for MDEV-26507.
2022-04-10 14:46:24 +04:00