Commit graph

188635 commits

Author SHA1 Message Date
Marko Mäkelä
0d1ca19383 One more fixup for sizeof(mtr_t) reduction
Add explicit casts when assigning ulint to m_user_space_id.
2020-02-07 13:44:13 +02:00
Marko Mäkelä
91e7b44399 mtr_t::get_log_mode(): Remove a redundant assertion
mtr_log_t and mtr_t::m_log_mode have the same range 0 to 3.
2020-02-07 13:29:08 +02:00
Marko Mäkelä
2b260f2ddd Fixup the parent commit
mtr_t::get_log_mode(): Use equivalent static_assert().

mtr_t::m_n_log_recs: Do not exceed the number of bits in uint16_t.
2020-02-07 13:15:33 +02:00
Thirunarayanan Balathandayuthapani
3be751d5b9 MDEV-21608 Assertion `n_ext == dtuple_get_n_ext(dtuple)' failed during updation of PK
- n_ext value may be less than dtuple_get_n_ext(dtuple) when PK is being
updated and new record inherits the externally stored fields from
delete mark old record.
2020-02-07 16:01:31 +05:30
Marko Mäkelä
9a999469f7 Cleanup: Recude sizeof(mtr_t)
Use bit-fields for some mtr_t members to improve locality of reference.
Because mtr_t is never shared between threads, there are no considerations
regarding concurrent access.
2020-02-07 12:07:12 +02:00
Thirunarayanan Balathandayuthapani
80da232576 MDEV-21563 FTS thread aborts during shutdown
- Added the test case in innodb_fts suite
- Updated copyright year in row0mysql.cc
2020-02-07 15:22:23 +05:30
Marko Mäkelä
8b6cfda631 Merge 10.4 into 10.5 2020-02-07 08:51:20 +02:00
Marko Mäkelä
8b97eba31b MDEV-21674 purge_sys.stop() fails to wait for purge workers to complete
Since commit 5e62b6a5e0 (MDEV-16264),
purge_sys_t::stop() no longer waited for all purge activity to stop.

This caused problems on FLUSH TABLES...FOR EXPORT because of
purge running concurrently with the buffer pool flush.
The assertion at the end of buf_flush_dirty_pages() could fail.

The, implemented by Vladislav Vaintroub, aims to eliminate race
conditions when stopping or resuming purge:

waitable_task::disable(): Wait for the task to complete, then replace
the task callback function with noop.

waitable_task::enable(): Restore the original task callback function
after disable().

purge_sys_t::stop(): Invoke purge_coordinator_task.disable().

purge_sys_t::resume(): Invoke purge_coordinator_task.enable().

purge_sys_t::running(): Add const qualifier, and clarify the comment.
The purge coordinator task will remain active as long as any purge
worker task is active.

purge_worker_callback(): Assert purge_sys.running().

srv_purge_wakeup(): Merge with the only caller purge_sys_t::resume().

purge_coordinator_task: Use static linkage.
2020-02-07 08:12:58 +02:00
Thirunarayanan Balathandayuthapani
280bf17829 MDEV-21563 FTS thread aborts during shutdown
Problem:
=======
After discarding the table, fts_optimize_thread aborts during shutdown.
InnoDB fails to remove the table from fts_optimize_wq and it leads to
the fts_optimize_thread to lookup for the auxiliary table and fails.

Fix:
====
While discarding the fts table, remove the table from fts_optimize_wq.
2020-02-06 20:42:29 +05:30
Marko Mäkelä
cd3bdc09db MDEV-18582: Fix a race condition
srv_export_innodb_status(): While gathering
innodb_mem_adaptive_hash, acquire btr_search_latches[i]
in order to prevent a race condition with buffer pool resizing.
2020-02-06 14:52:11 +02:00
Marko Mäkelä
ebbc572b82 MDEV-12121: Clean up WITH_INNODB_AHI=OFF
buf_flush_or_remove_pages(): Only define BUF_LRU_DROP_SEARCH_SIZE
and dependent code when the adaptive hash index has been enabled.
2020-02-06 10:50:04 +02:00
Marko Mäkelä
6d214415c9 MDEV-21351: Free processed recv_sys_t::blocks
Release memory as soon as redo log records are processed.

Because the memory allocation and deallocation of parsed redo log
records must be protected by recv_sys.mutex, it is better to avoid
using a std::atomic field for bookkeeping.

buf_page_t::access_time: Keep track of the recv_sys.pages record
allocations. The most significant 16 bits will count allocated
blocks (which were previously counted by buf_page_t::buf_fix_count
in the debug version), and the least significant 16 bits indicate
the number of allocated bytes in the block (which was previously
managed in buf_block_t::modify_clock), which must be a positive
number, up to innodb_page_size. The byte offset 65536 is represented
as the value 0.

recv_recover_page(): Let the caller erase the log.

recv_validate_tablespace(): Acquire recv_sys_t::mutex.
2020-02-06 09:00:19 +02:00
Aurélien LEQUOY
236aed3f5f MDEV-21656: Wrong directory for pam_user_map.so
JIRA:https://jira.mariadb.org/browse/MDEV-17292

Closes #1443
2020-02-06 07:48:37 +01:00
Oleksandr Byelkin
fafb35ee51 MDEV-20076: SHOW GRANTS does not quote role names properly
Quotes added to output.
2020-02-05 17:22:26 +01:00
Oleksandr Byelkin
a241d41195 MDEV-18027: Running out of file descriptors and eventual crash
For automatic number of opened files limit take into account number of table instances for table cache
2020-02-05 15:34:02 +01:00
Oleksandr Byelkin
c1eaa385ff MDEV-21616: Server crash when using "SET STATEMENT max_statement_time=0 FOR desc xxx" lead to collapse
Main select should be pushed first.
2020-02-05 13:37:12 +01:00
Marko Mäkelä
2acc6f2d95 MDEV-21658 Error on online ADD PRIMARY KEY after instant DROP/reorder
row_log_table_get_pk_old_col(): For replacing a NULL value for a
column of the being-added primary key, look up the correct
default value, even if columns had been instantly reordered or
dropped earlier. This ought to have been broken ever since
commit 0e5a4ac253 (MDEV-15562).
2020-02-05 11:12:10 +02:00
mkaruza
d0c8316bf5
Incorrect behaviour of WSREP_SYNC_WAIT_UPTO_GTID (#1442)
Function `signal_waiters` assigned `m_committed_seqno` variable outside of
mutex lock which caused incorrect behavior of WSREP_SYNC_WAIT_UPTO_GTID.
Fixed by moving assignment inside lock. Added handling of OOM and now
error is reported.
Remove hard-coded seqno value and read seqno directly from current node state.
2020-02-05 10:02:33 +02:00
Sergei Petrunia
b3ded21922 ha_partition: add comments, comment out unused member variables 2020-02-05 00:54:16 +03:00
Sergey Vojtovich
daaa881cfe libpmem cmake macros
Also added support for MAP_SYNC. It allows to achieve decent performance
with DAX devices even when libpmem is unavailable.

Fixed Windows version of my_msync(): according to manual FlushViewOfFile()
may return before flush is actually completed. It is advised to issue
FlushFileBuffers() after FlushViewOfFile().
2020-02-04 23:23:50 +04:00
Marko Mäkelä
a56f78243e MDEV-21645 SIGSEGV in innobase_get_computed_value
ha_innobase::commit_inplace_alter_table(): After
ALTER_STORED_COLUMN_ORDER, ensure that the virtual column metadata
will be reloaded also when the table is not being rebuilt.
2020-02-04 16:36:58 +02:00
Sujatha
42e825dd0a MDEV-20601: Make REPLICA a synonym for SLAVE in SQL statements
Fix:
===
Add "REPLICA" as an alias for "SLAVE". All commands which use "SLAVE" keyword
can be used with new alias "REPLICA".

List of commands:

On Master:
=========
SHOW REPLICA HOSTS <--> SHOW SLAVE HOSTS
Privilege "SLAVE"  <--> "REPLICA"

On Slave:
=========
START SLAVE       <--> START REPLICA
START ALL SLAVES  <--> START ALL REPLICAS
START SLAVE UNTIL <--> START REPLICA UNTIL
STOP SLAVE        <--> STOP REPLICA
STOP ALL SLAVES   <--> STOP ALL REPLICAS
RESET SLAVE       <--> RESET REPLICA
RESET SLAVE ALL   <--> RESET REPLICA ALL
SLAVE_POS         <--> REPLICA_POS
2020-02-04 18:16:21 +05:30
Jan Lindström
46386661a2 MDEV-20625 : MariaDB asserting when enabling wsrep_on
We need to release global system variables mutex before
doing wsrep_init to avoid race with next show status and
we need to save wsrep_on value as it is changed on wsrep_init.
Added test case.
2020-02-04 11:14:21 +02:00
Julius Goryavsky
93278ee8ad MDEV-20625: MariaDB asserting when enabling wsrep=on 2020-02-04 08:56:03 +02:00
Jan Lindström
574354a6b2 MDEV-20625 : MariaDB asserting when enabling wsrep_on
When wsrep_on is changed to ON we might need to run wsrep_init
if wsrep-provider is set and wsrep is not inited.
2020-02-03 19:45:30 +02:00
Marko Mäkelä
a9d1324867 Cleanup: Remove mem_block_t::magic_n and mem_block_validate()
Use of freed memory is better caught by AddressSanitizer,
especially with ASAN_POISON_MEMORY_REGION that is aliased
by MEM_NOACCESS and UNIV_MEM_FREE.
2020-02-03 12:34:08 +02:00
Marko Mäkelä
37b9734c06 MDEV-21636 information_schema.innodb_mutexes.name column is not populated
The column INFORMATION_SCHEMA.INNODB_MUTEXES.NAME is not populated ever since
commit 2e814d4702 applied the InnoDB changes from
MySQL 5.7.9 to MariaDB Server 10.2.2.

Since the same commit, the view is only providing information about
rw_lock_t, not any mutexes.

For now, let us convert the source code file name and line number of
the rw_lock_t creation into a name. A better option in the future might
be to store the information somewhere where it can be looked up by
mysql_pfs_key_t, and possibly to remove the CREATE_FILE and CREATE_LINE
columns.
2020-02-03 12:34:08 +02:00
Eugene Kosov
287c1db786 try to fix Win x86 build 2020-02-03 17:59:14 +08:00
Sachin
eed6d215f1 MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes
Problem:-

So the issue is when we do bulk insert with rows
> MI_MIN_ROWS_TO_DISABLE_INDEXES(100) , We try to disable the indexes to
speedup insert. But current logic also disables the long unique indexes.

Solution:- In ha_myisam::start_bulk_insert if we find long hash index
(HA_KEY_ALG_LONG_HASH) we will not disable the index.

This commit also refactors the mi_disable_indexes_for_rebuild function,
Since this is function is called at only one place, it is inlined into
start_bulk_insert

mi_clear_key_active is added into myisamdef.h because now it is also used
in ha_myisam.cc file.

(Same is done for Aria Storage engine)
2020-02-03 12:44:31 +05:30
Aleksey Midenkov
b615d275b8 MDEV-17798 System variable system_versioning_asof accepts wrong values (10.4) 2020-02-02 17:13:58 +03:00
Aleksey Midenkov
b0fa308086 MDEV-21195 INSERT chooses wrong partition for RANGE partitioning by DECIMAL column
Use FLOOR rounding for DECIMAL_RESULT item_expr in partition function.
2020-02-02 15:13:29 +03:00
Aleksey Midenkov
74deeaee34 MDEV-21317 mysqlhotcopy and transaction_registry table
See also original report:
http://bugs.debian.org/946671

Using mysqlhotcopy, the following error occurs:

DBD::mysql::db do failed: You can't use locks with log tables at
/usr/bin/mysqlhotcopy line 545.

Author:

Paul Szabo psz@maths.usyd.edu.au http://www.maths.usyd.edu.au/u/psz/
School of Mathematics and Statistics University of Sydney Australia
2020-02-02 15:13:29 +03:00
Aleksey Midenkov
e13e49e5ab MDEV-20528 innodb.purge_secondary_mdev-16222 failed in buildbot, debug sync point wait timed out 2020-02-02 15:13:29 +03:00
Aleksey Midenkov
006f6f97b1 MDEV-17798 System variable system_versioning_asof accepts wrong values 2020-02-02 15:13:29 +03:00
Aleksey Midenkov
14e6f0251c MDEV-20955 versioning.update failed in buildbot with wrong result code
Race condition when innodb_lock_wait_timeout (default 50 seconds)
exceeds for 'send update', but information_schema.innodb_lock_waits
still sees this wait or it my exit by timeout. My occur on overloaded
host.
2020-02-02 15:13:29 +03:00
Sachin Setiya
5a6023cf6f MDEV-18791 Wrong error upon creating Aria table with long index on BLOB
If we have long unique key for aria engine return too long key error, because
Aria does not support key on virtual generated column.
2020-02-02 13:53:26 +05:30
Eugene Kosov
691c691adc clean up redo log
main change: rename first redo log without file close

second change: use os_offset_t to represent offset in a file

third change: fix log texts
2020-02-01 23:58:24 +08:00
Marko Mäkelä
1b414c0313 MDEV-21256 after-merge fix: Use std::atomic
Starting with MariaDB Server 10.4, C++11 is being used.
Hence, std::atomic should be preferred to my_atomic.
2020-02-01 15:06:12 +02:00
Marko Mäkelä
4b291588bb MDEV-19845: Make my_cpu.h self-contained
Fix up commit f5c080c735
2020-02-01 14:56:05 +02:00
Eugene Kosov
bd36a4ca12 introduce HASH_REPLACE() for hash_table_t
HASH_REPLACE(): allows to not travel through linked list twice
when HASH_INSERT() happens right after HASH_DELETE()
2020-01-31 22:14:18 +08:00
Marko Mäkelä
c8bd8d5c64 MDEV-14330: After-merge fix
The merge commit 5ff66fb0b9
accidentally omitted part of
commit 07e34cddb6.
2020-01-31 13:16:11 +02:00
Marko Mäkelä
5ff66fb0b9 Merge 10.2 into 10.3 2020-01-31 11:37:12 +02:00
Marko Mäkelä
256994ef74 MDEV-21586: Fix a warning for converting my_bool to bool 2020-01-31 11:33:07 +02:00
Marko Mäkelä
2daf3b14fe Merge 10.1 into 10.2 2020-01-31 10:53:56 +02:00
Marko Mäkelä
0b36c27e0c MDEV-20307: Remove a useless debug check to save stack space
fil_space_encrypt(): Remove the debug check that decrypts the
just encrypted page. We are exercising the decryption of encrypted
pages enough via --suite=encryption,mariabackup. It is a waste of
computing resources to decrypt every page immediately after encrypting it.

The redundant check had been added in
commit 2bedc3978b (MDEV-9931).
2020-01-31 10:06:55 +02:00
Marko Mäkelä
d87b725eeb MDEV-17844 recs_off_validate() fails in page_zip_write_trx_id_and_roll_ptr()
In commit 0e5a4ac253 (MDEV-15562)
we introduced was a bogus debug check failure that does not affect
the correctness of the release build.

With a fixed-length PRIMARY KEY, we do not have to recompute
the rec_get_offsets() after restarting the mini-transaction,
because the offsets of DB_TRX_ID,DB_ROLL_PTR are not going
to change.

row_undo_mod_clust(): Invoke rec_offs_make_valid() to keep the
debug check in page_zip_write_trx_id_and_roll_ptr() happy.

The scenario to reproduce this bug should be rather unlikely:
In the time frame when row_undo_mod_clust() has committed its
first mini-transaction and has not yet started the next one,
another mini-transaction must do something that causes the page
to be reorganized, split or merged.
2020-01-31 09:54:43 +02:00
Marko Mäkelä
88bcc7f21c Fixup cd2c0e013c
The variable 'dlh' was being used uninitialized if WSREP_PROVIDER
is not set.
2020-01-31 09:17:12 +02:00
Sachin
a10a94b262 Empty commit 2020-01-31 11:47:17 +05:30
Vladislav Vaintroub
f37a56de3c MDEV-21586 Server does not start if lc_messages setting was not english.
Fixed a bug introduced in  MDEV-11345, server did not start if
non-english error messages were set in startup parameters.

Added lc_messages=de_DE option into an existing test case.
2020-01-30 18:43:50 +01:00
mkaruza
74f7620636 MDEV-21598 Galera test galera.galera_sst_mysqldump does not take wsrep-new-cluster into account
Variable `wsrep_new_cluster` should be set to false after `wsrep_init_startup`.
Problem was that this was done before when mysqldump is used as SST method so option
wsrep-new-cluster didn't have any effect.
2020-01-30 14:53:42 +02:00