Commit graph

188706 commits

Author SHA1 Message Date
Marko Mäkelä
0a7faed75a MDEV-22771 Instant extension of CHAR column is wrongly allowed
commit 854c219a7f (MDEV-17301)
broke a constraint: Fixed-length columns cannot be extended in InnoDB
without rebuilding the table.

ha_innobase::can_convert_string(): Correct the condition. We must
not allow any instantaneous change to the length of CHAR columns
measured in characters. For any format other than ROW_FORMAT=REDUNDANT,
we can allow the length in bytes to be extended if mbminlen<mbmaxlen held
before the change of the character set.
2020-07-20 14:15:56 +03:00
Julius Goryavsky
956f21c3b0 Merge remote-tracking branch 'origin/bb-10.4-MDEV-21910' into 10.4 2020-07-16 13:03:29 +02:00
Marko Mäkelä
3280edda89 Merge 10.3 into 10.4 2020-07-16 06:57:50 +03:00
Marko Mäkelä
73aa31fbfd Merge 10.2 into 10.3 2020-07-16 06:55:23 +03:00
Marko Mäkelä
147d4b1ec0 MDEV-21347 innodb_log_optimize_ddl=OFF is not crash safe
In commit 0f90728bc0 (MDEV-16809)
we introduced the configuration option innodb_log_optimize_ddl
for controlling whether native index creation or table-rebuild
in InnoDB should avoid writing full redo log.

Fungo Wang reported that this option is causing occasional failures.
The reason is that pages may be written to data files in an
inconsistent state. Applying log records to such inconsistent pages
may fail.

The solution is to always invoke PageBulk::finish() before page latches
may be released, to ensure that the page contents is in a consistent
state.

Something similar was implemented in MySQL 8.0.13:
mysql/mysql-server@d1254b9473

buf_block_t::skip_flush_check: Remove. Suppressing consistency checks
is a bad idea.

PageBulk::needs_finish(): New predicate: Determine whether
PageBulk::finish() must fix up the page.

PageBulk::init(): Clear PAGE_DIRECTION to ensure that needs_finish()
will hold. We change the field from PAGE_NO_DIRECTION to 0
and back without writing redo log. This trick avoids the need
to introduce any new data member to PageBulk.

PageBulk::insert(): Replace some high-level accessors to bypass
debug assertions related to PAGE_HEAP_TOP that we will be violating
until finish() has been executed.

PageBulk::finish(): Tolerate m_rec_no==0. We must invoke this also
on an empty page, to ensure that PAGE_HEAP_TOP is initialized.

PageBulk::commit(): Always invoke finish().

PageBulk::release(), BtrBulk::pageSplit(), BtrBulk::storeExt(),
BtrBulk::finish(): Invoke PageBulk::finish().
2020-07-16 06:35:15 +03:00
Marko Mäkelä
fee11c7727 Make page validation stricter
page_simple_validate_old(), page_simple_validate_new():
Require PAGE_N_DIR_SLOTS to be at least 2.
2020-07-15 19:41:01 +03:00
Marko Mäkelä
38b4c07833 MDEV-23183 Infinite loop on page_validate() on corrupted page
MDEV-22721 (commit eba2d10ac5)
inadvertently introduced an infinite loop.

page_validate(): Remove the infinite loop.
2020-07-15 19:41:01 +03:00
Vladislav Vaintroub
9c8420fe8c Fix compile warning 2020-07-15 09:49:48 +02:00
Marko Mäkelä
ced3ec4c9c Revert MDEV-20453 (string_view)
In fsp_path_to_space_name(), we would access a byte right before
the start of the string, tripping AddressSanitizer.

This reverts commit d87006a1c1
and commit a7634281aa.
2020-07-15 10:26:31 +03:00
Marko Mäkelä
9936cfd531 Merge 10.3 into 10.4 2020-07-15 10:17:15 +03:00
Marko Mäkelä
8a0944080c Merge 10.2 into 10.3 2020-07-14 22:59:19 +03:00
Eugene Kosov
a7634281aa fix header includes 2020-07-14 21:11:25 +03:00
Eugene Kosov
d87006a1c1 MDEV-20453 add class similar to std::string_view (non owning string reference)
This version is not optimized yet. It could have bugs because I didn't
check it with unit tests. Also, std::char_traits are not really supported.
So, now it's not possible to create f.ex. a case insensitive string_view.

fil_path_to_space_name(): renamed, moved to another file
and refactored to use string_view
2020-07-14 21:02:16 +03:00
Marko Mäkelä
07e89bf7d1 MDEV-23163 Merge new release of InnoDB 5.7.31 to 10.2
The only InnoDB change between MySQL 5.7.30 and MySQL 5.7.31
that is applicable to MariaDB Server was applied in
commit 8d061996e6 (MDEV-23161).
2020-07-14 15:13:40 +03:00
Marko Mäkelä
646a6005e7 Merge 10.1 into 10.2 2020-07-14 15:10:59 +03:00
Marko Mäkelä
67a03b7c94 XtraDB 5.6.48-88.0
The only InnoDB changes between Percona XtraDB Server 5.6.47-87.0
and 5.6.48-88.0 are related to InnoDB changes between MySQL 5.6.47
and MySQL 5.6.48, which we had already applied.
2020-07-14 13:32:32 +03:00
Marko Mäkelä
142f85142a Update the InnoDB version number to 5.6.49
There were no InnoDB changes between MySQL 5.6.48 and MySQL 5.6.49.
2020-07-14 13:25:18 +03:00
Marko Mäkelä
8d061996e6 MDEV-23161 avg_count_reset may wrongly be NULL in I_S.INNODB_METRICS
This issue was originally reported by Fungo Wang, along with a fix, as
MySQL Bug #98990.

His suggested fix was applied as part of
mysql/mysql-server@a003fc373d
and released in MySQL 5.7.31.

i_s_metrics_fill(): Add the missing call to Field::set_notnull(),
and simplify some code.
2020-07-14 13:21:01 +03:00
Eugene Kosov
e3a6916895 remove dead code: fil_create_directory_for_tablename() 2020-07-14 13:16:19 +03:00
Thirunarayanan Balathandayuthapani
dc58987eb7 MDEV-22765 i_s_fts_index_cache_fill_one_index() is not protect by the lock
- i_s_fts_index_cache_fill() should take shared lock of fts cache
before accessing index cache to avoid reading stale data.
2020-07-14 14:26:49 +05:30
Julius Goryavsky
6b6c012f33 Merge branch '10.4-MDEV-18838' of https://github.com/codership/mariadb-server into 10.2-MDEV-18838 2020-07-14 10:45:41 +02:00
Thirunarayanan Balathandayuthapani
e80183dbd5 MDEV-15662 mariabackup.huge_lsn fails sporadically with "log sequence number is in the future"
- Problem is that test case creates iblogfile* files. So existing
ibdata pages could point to future LSN. Fix is that taking the
backup of data before iblogfile* creation and apply it before
exiting the test case.
2020-07-14 13:24:37 +05:30
Julius Goryavsky
df1846aeea Merge branch '10.4-MDEV-18838' of https://github.com/codership/mariadb-server into 10.4-MDEV-22966 2020-07-14 09:36:38 +02:00
Thirunarayanan Balathandayuthapani
194a720e28 MDEV-22890 DEADLOCK of threads detected: row0sel.cc S-LOCK / btr0cur.cc S-LOCK / row0quiesce.cc X-LOCK
Problem:
=======
- Read operations are always allowed to hold a secondary index leaf
latch and then look up the corresponding clustered index record.
Flush table operation acquires secondary index latch while holding
a clustered index latch. It leads to deadlock violation.

Fix:
====
- Flush table operation should acquire secondary index before taking
clustered index to avoid deadlock violation with select operation.
2020-07-14 12:47:32 +05:30
Vicențiu Ciorbaru
f73db93329 MDEV-23027 symlink_wsrep_sst_rsync target built when WITH_WSREP is off
Only install wsrep scripts and links if WSREP_ON is actually set
2020-07-13 20:40:52 +03:00
Varun Gupta
b0df247db6 MDEV-22463: Element_type &Bounds_checked_array<Item *>::operator[](size_t) [Element_type = Item *]: Assertion `n < m_size' failed.
Allocate space for fields inside the window function (arguments, PARTITION BY and ORDER BY clause)
in the ref pointer array. All fields inside the window function are part of the temporary
table that is required for the window function computation.
2020-07-13 22:04:54 +05:30
Marko Mäkelä
de20872331 MDEV-22988 Corrupted table after DROP INDEX
This form of corruption was only reproduced on MariaDB 10.5.4
after the MDEV-22867 fix was applied in
commit 431200090e.

While we do not know how to reproduce this corruption in
MariaDB 10.4, we are applying the code fix without a test case.

btr_cur_pessimistic_update(): Invoke btr_set_instant() if needed.
2020-07-13 16:44:46 +03:00
Rucha Deodhar
0994af43e5 MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status
Error state is not stored in check_and_do_in_subquery_rewrites() when there is
illegal combination of optimizer switches. So all the functions eventually
return false. Thus the assetion failure.
2020-07-12 20:03:32 +05:30
Eugene Kosov
5d471453ed noexcept ilist 2020-07-11 12:55:34 +03:00
Alexey Botchkov
873eb4a397 MDEV-21385 PAM v2 plugin produces lots of zombie processes.
The auth_pam_tool that is executed from pam_auth() can be still
not finished by the time we do the waitpid() there.
As we use WNOHANG option for the waitpid(), it didn't wait and
left the zombie process. So let's do the loop of waitpid() with the
limited number of sleeps.
2020-07-10 22:48:35 +04:00
Rucha Deodhar
f81ff93287 MDEV-19119: main.ssl_crl fails in buildbot with wrong error code
The client can only find out if the server has disconnected when it tries to
read or send something. If the server gets disconnected before
send_client_reply_packet(), the client will try sending authentication
information but it will fail. But, if the client is fast enough to send
autentication information before disconnecting, it will notice that when
reading the ok packet. So the client can fail on read or on write.
It is unpredictable because, the process are unsynchronized and this
could happen in any order.
2020-07-10 21:27:20 +05:30
Varun Gupta
737c3025e9 MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT()
Reject queries that have aggregate functions with UNION as these
are not allowed by standard.
2020-07-10 00:01:24 +05:30
Oleksandr Byelkin
a759f9af51 Fix typo in the comment (and old info) 2020-07-09 08:54:59 +02:00
Sergei Petrunia
41221091f6 MDEV-22553: Assertion `info->lastpos == (~ (my_off_t) 0)' failed in mi_rkey
In mi_check_index_tuple(), when rowid filter check returns
CHECK_OUT_OF_RANGE, set info->lastpos= HA_OFFSET_ERROR, like
it is done above for the ICP check.
2020-07-08 23:27:19 +03:00
Oleksandr Byelkin
0d6d801e58 MDEV-23102 10.4 create mariadb.sys user on each update even is the user is not needed
Check if we really need the mariadb.sys user
2020-07-08 13:10:07 +02:00
Vicențiu Ciorbaru
f18c5a7ed7 MDEV-23114 AUTH_PAM plugin can not be disabled when using mysql_release config
When setting the PLUGIN_AUTH_PAM variable, mark it as a "CACHE" variable
so it can be overridden by the user.
2020-07-07 17:59:47 +03:00
Varun Gupta
253aa7bbc4 MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
Pass the unsigned flag from the Item_sum to the window function
2020-07-07 17:30:53 +05:30
Rucha Deodhar
a536625553 MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())'
failed in Diagnostics_area::set_ok_status on FUNCTION replace

When there is REPLACE in the statement, sp_drop_routine_internal() returns
0 (SP_OK) on success which is then assigned to ret. So ret becomes false
and the error state is lost. The expression inside DBUG_ASSERT()
evaluates to false and thus the assertion failure.
2020-07-06 21:17:15 +05:30
Vladislav Vaintroub
cad9a9b1f8 MDEV-23098 mariadb-upgrade-service.exe does not work on WAMPServer
While trying to detect datadir, take into account that one can use
Windows service name as section name in options file, for Windows service.

The historical obscurity is being used by WAMP installations.
2020-07-06 13:51:25 +02:00
Varun Gupta
6163af9397 MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft | SIGSEGV in __memmove_avx_unaligned_erms from my_b_write
Make sure that the sort_buffer that is allocated has atleast space for MERGEBUFF2 keys.
The issue here was that the record length is quite high and sort buffer size is very small,
due to which we end up with zero number of keys in the sort buffer. The Sort_param::max_keys_per_buffer
was zero in such a case, due to which we were flushing empty sort_buffer to the disk.
2020-07-06 16:30:27 +05:30
Daniel Black
3efdac2064 MDEV-22173: socket accept - test for failure
accept might return an error, including SOCKET_EAGAIN/
SOCKET_EINTR. The caller, usually handle_connections_sockets
can these however and invalid file descriptor isn't something
to call fcntl on.

Thanks to Etienne Guesnet (ATOS) for diagnosis,
sample patch description and testing.
2020-07-06 12:33:35 +02:00
Marko Mäkelä
f3f23b5c4b One more ASAN/MSAN cleanup
commit 484931325e included a
workaround for a 10.5 merge issue that should now be properly
addressed in commit ab4069909d.

buf_chunk_init(): Remove an unnecessary MEM_MAKE_ADDRESSABLE().
We might invoke MEM_UNDEFINED() here, but actually the allocated
memory ought to be guaranteed to be zero-initialized.
2020-07-05 16:31:34 +03:00
Marko Mäkelä
b99fa1e767 Merge 10.3 into 10.4 2020-07-04 22:11:16 +03:00
Marko Mäkelä
453dc4b300 Fixup the parent commit for MSAN and Valgrind
commit 484931325e was a necessary
fix for the buffer pool resizing tests in 10.5 in
AddressSanitizer. However, that change would break the tests
innodb.innodb_buffer_pool_resize and
innodb.innodb_buffer_pool_resize_with_chunks
when run in MemorySanitizer, or presumably in Valgrind as well.
(Those tests run "forever" in Valgrind.)

buf_pool_resize(): Cancel the effect of MEM_NOACCESS() in Valgrind
and ASAN. In MSAN, MEM_NOACCESS() is a no-op, and hence we must do
nothing special here.

MEM_MAKE_ADDRESSABLE() would declare the memory contents undefined.
In this particular case, we must actually declare the contents
defined for Valgrind.
2020-07-04 22:02:30 +03:00
Monty
e9f06b19e0 Merge remote-tracking branch 'origin/10.3' into 10.4 2020-07-03 20:26:09 +03:00
Monty
484931325e Fix for MSAN from Marko related to buf_pool_resize 2020-07-03 18:37:33 +03:00
Julius Goryavsky
1bf863a91a Merge branch '10.4-MDEV-22222' of https://github.com/codership/mariadb-server into 10.4-MDEV-22222 2020-07-03 16:17:59 +02:00
Monty
e6595a06d6 Don't give errors for default value copy in create_tmp_table 2020-07-03 01:18:51 +03:00
Monty
6e81ba0c12 Don't give errors for default value copy in create_tmp_table 2020-07-03 01:16:31 +03:00
Monty
5211af1c16 Merge remote-tracking branch 'origin/10.3' into 10.4 2020-07-03 00:35:28 +03:00