Commit graph

23348 commits

Author SHA1 Message Date
Marko Mäkelä
c2a929185c MDEV-17491 post-fix: GCC 7 -Wclass-memaccess
commit 3a37644a29 added a non-POD
member buf_page_info_t::id, and thus GCC 7 or later would complain
about a memset() call. Let my_malloc fill the memory for us.
2020-05-27 18:56:49 +03:00
Sergey Vojtovich
d72594d45d Fixed main.implicit_commit ASAN failure
InnoDB mutex monitor is accessing mutexes of poisoned (cached) trx
objects. Unpoison ReadView::m_mutex similarly to trx_t::mutex.

This is regression after MDEV-22593.
2020-05-27 19:43:20 +04:00
Monty
2347c18c79 Renamed maria_* source files for executables to aria_* 2020-05-27 15:47:10 +03:00
Monty
c52e62a76f Improve logging of Aria redo's and undo's
- Remove extra ',' and quotes
- Remove extra newline and remove double newlines
- Added options --lsn-redo-end and --lsn-undo-end to aria_read_log
- Allow one to give the aria_read_log lsn aruments as number,0xhexnumber,
  the same way as lsn's are written by aria_read_log
- Don't write full pages to redo log with EXTRA_DEBUG as this takes up
  a lot of disk and there has not been a need for this extra loggging for
  a long time. Instead one should use EXTRA_ARIA_DEBUG instead.
2020-05-27 15:47:10 +03:00
Monty
514533eb9a aria_chk sets --warning-if-wrong-transid=0 if --ignore-control-file is used 2020-05-27 15:47:10 +03:00
Marko Mäkelä
3a37644a29 MDEV-17491: Use the optimized page_id_t more
commit 8ccb3caafb micro-optimized
page_id_t as a wrapper of uint64_t.

buf_dump_t: Remove, and replace with page_id_t, which uses
exactly the same encoding.

buf_page_info_t: Replace space_id,page_num with page_id_t id.

i_s_innodb_set_page_type(): Remove unnecessary code.
The buf_page_info_t::id was already assigned at the start
of the only caller, i_s_innodb_buffer_page_get_info().
2020-05-27 09:00:52 +03:00
Marko Mäkelä
5ebd6452fd MDEV-22697: Post-push fix clang -Wnon-pod-varargs 2020-05-27 08:50:24 +03:00
Sergey Vojtovich
03dcdad251 MDEV-22697 - InnoDB: remove trx->no
trx->no is duplicated by trx->rw_trx_hash_element->no for no good reason.
The latter is preferred for performance reasons: allows to avoid taking
trx->rw_trx_hash_element->mutex when snapshotting.
2020-05-26 17:11:31 +04:00
Sergey Vojtovich
50b0ce44a2 MDEV-22593 - InnoDB: don't take trx_sys.mutex in ReadView::open()
This was the last abuse of trx_sys.mutex, which is now exclusively
protecting trx_sys.trx_list.

This global acquisition was also potential scalability bottleneck for
oltp_read_write benchmark. Although it didn't expose itself as such due
to larger scalability issues.

Replaced trx_sys.mutex based synchronisation between ReadView creator
thread and purge coordinator thread performing latest view clone with
ReadView::m_mutex.

It also allowed to simplify tri-state view m_state down to boolean
m_open flag.

For performance reasons trx->read_view.close() is left as atomic relaxed
store, so that we don't have to waste resources for otherwise meaningless
mutex acquisition.
2020-05-26 17:11:20 +04:00
Marko Mäkelä
d8ea11a33f MDEV-22669 fixup: WITH_MSAN build fix 2020-05-25 09:47:35 +03:00
Monty
59f011943f MDEV-22686 # Assertion `trn' failed in ha_maria::start_stmt
Calling stmt rollback closed the transaction, which caused the above issue
2020-05-24 19:29:56 +03:00
Monty
c4bf4b7aef Fixed access to undefined memory found by valgrind and MSAN
When my_vsnprintf() is patched, the code protected disabled with
'WAITING_FOR_BUGFIX_TO_VSPRINTF' should be enabled again. Also all %b
formats in this patch should be revert to %s again
2020-05-23 12:29:10 +03:00
Monty
dcc0baf540 Don't print "Trying to delete tablespace several 10x times per second"
Now this InnoDB message is printed after one second of stalled operations
and then every 10 seconds
2020-05-23 12:29:10 +03:00
Monty
4ea171ffab Fixed compiler warnings from gcc and clang 5.0.1 2020-05-23 12:29:10 +03:00
Monty
4102f1589c Aria will now register it's transactions
MDEV-22531 Remove maria::implicit_commit()
MDEV-22607 Assertion `ha_info->ht() != binlog_hton' failed in
           MYSQL_BIN_LOG::unlog_xa_prepare

From the handler point of view, Aria now looks like a transactional
engine. One effect of this is that we don't need to call
maria::implicit_commit() anymore.

This change also forces the server to call trans_commit_stmt() after doing
any read or writes to system tables.  This work will also make it easier
to later allow users to have system tables in other engines than Aria.

To handle the case that Aria doesn't support rollback, a new
handlerton flag, HTON_NO_ROLLBACK, was added to engines that has
transactions without rollback (for the moment only binlog and Aria).

Other things
- Moved freeing of MARIA_SHARE to a separate function as the MARIA_SHARE
  can be still part of a transaction even if the table has closed.
- Changed Aria checkpoint to use the new MARIA_SHARE free function. This
  fixes a possible memory leak when using S3 tables
- Changed testing of binlog_hton to instead test for HTON_NO_ROLLBACK
- Removed checking of has_transaction_manager() in handler.cc as we can
  assume that as the transaction was started by the engine, it does
  support transactions.
- Added new class 'start_new_trans' that can be used to start indepdendent
  sub transactions, for example while reading mysql.proc, using help or
  status tables etc.
- open_system_tables...() and open_proc_table_for_Read() doesn't anymore
  take a Open_tables_backup list. This is now handled by 'start_new_trans'.
- Split thd::has_transactions() to thd::has_transactions() and
  thd::has_transactions_and_rollback()
- Added handlerton code to free cached transactions objects.
  Needed by InnoDB.

squash! 2ed35999f2a2d84f1c786a21ade5db716b6f1bbc
2020-05-23 12:29:10 +03:00
Monty
d1d472646d Change THD->transaction to a pointer to enable multiple transactions
All changes (except one) is of type
thd->transaction.  -> thd->transaction->

thd->transaction points by default to 'thd->default_transaction'
This allows us to 'easily' have multiple active transactions for a
THD object, like when reading data from the mysql.proc table
2020-05-23 12:29:10 +03:00
Monty
7ae812cf2c Fix that BACKUP STAGE BLOCK_COMMIT blocks commit to the Aria engine
MDEV-22468 BACKUP STAGE BLOCK_COMMIT should block commit in the Aria engine

This is needed to ensure that mariabackup works properly with Aria tables

This code ads new calls to ha_maria::implicit_commit(). These will be
deleted by MDEV-22531 Remove maria::implicit_commit().
2020-05-23 12:29:10 +03:00
Monty
b15615631f MDEV-18286 Assertion `pagecache->cnt_for_resize_op ...
This patch is also pushed in 10.4. It's pushed separately in 10.5 as there
are some additional cases in 10.5 to take care of.

When merging if there is conflicts, use this code, not the 10.4 code.
2020-05-23 12:29:10 +03:00
Monty
7cb160961c Changed debug label XXX in ma_pagecache.cc XXX to proper lables 2020-05-23 12:29:10 +03:00
Monty
c287dc9b04 Fixed typo in variable description 2020-05-23 12:29:09 +03:00
Monty
8cf166bfb2 Update libmarias3 to fix a memory leak 2020-05-23 12:29:09 +03:00
Marko Mäkelä
51f0fa4eb3 Cleanup: Remove a startup message
The GCC __atomic_ functions were removed already in
commit 2b47f8ff03,
and starting with MariaDB Server 10.4, InnoDB relies mostly
on C++11 std::atomic.
2020-05-22 23:10:52 +03:00
Marko Mäkelä
afdd6b1da1 MDEV-22669 InnoDB lacks CRC-32C acceleration on IA-32
In mysql/mysql-server@17e497bdb7
MySQL 5.6.3 introduced innodb_checksum_algorithm=crc32 and
implemented it for AMD64 using the SSE 4.2 instructions
(incorrectly advertised as "SSE2" in a startup message).
It was not implemented on IA-32 or on Windows.

Since MariaDB 10.2.11 commit 2401d14e6b
we make use of the SSE4.2 CRC-32C instructions on Windows on both IA-32
and AMD64.

Let us be consistent and implement CRC-32C for IA-32 on all
available platforms. GCC 4.8.2 and GCC 4.8.5 complain
"error: PIC register clobbered by 'ebx' in 'asm'"
so we will only enable this code for IA-32 starting with GCC 5.

Also, we will clean up the implementation further after
commit 1312b4ebb6.

has_sse4_2(): Replaces ut_cpuid().

ut_crc32c_8(): Replaces ut_crc32_8_hw().

ut_crc32c_64(): Replaces ut_crc32_64_low_hw(), ut_crc32_64_hw().

ut_crc32_hw(): Rewrite.

ut_crc32c_8_sw(): Replaces ut_crc32_8_sw().

ut_crc32c_64_sw(): Replaces ut_crc32_64_low_sw(), ut_crc32_64_sw().

ut_crc32_sw(): Rewrite. Avoid code bloat and do not unroll the
ut_crc32c_64_sw() loop, because no benefit has been demonstrated.

ut_crc32_init(): Only invoke ut_crc32_slice8_table_init()
if no acceleration is available.
2020-05-22 22:59:59 +03:00
Sergei Golubchik
b934a34c46 compilation failure 2020-05-21 01:24:39 +02:00
Marko Mäkelä
5ece2155cb Merge 10.4 into 10.5 2020-05-20 17:46:05 +03:00
Marko Mäkelä
b8e694a314 Merge 10.3 into 10.4 2020-05-20 17:10:12 +03:00
Marko Mäkelä
ed41947b78 Merge 10.2 into 10.3 2020-05-20 17:07:09 +03:00
Marko Mäkelä
22a6fa572b MDEV-19114 post-push fix: SIGSEGV on INSERT
ins_node_create_entry_list(): Create dummy empty tuples for
corrupted or incomplete indexes, to avoid dereferencing a NULL
dict_field_t::col pointer in row_build_index_entry_low().

This issue was found by a crash in the test gcol.innodb_virtual_basic
when merging the fix to 10.5.
2020-05-20 16:35:48 +03:00
Marko Mäkelä
d8dc3c72b6 Merge 10.3 into 10.4 2020-05-20 12:25:23 +03:00
Marko Mäkelä
f4f0ef3e37 Merge 10.2 into 10.3 2020-05-20 11:41:51 +03:00
Marko Mäkelä
e380f44742 Merge 10.1 into 10.2 2020-05-20 11:13:40 +03:00
Thirunarayanan Balathandayuthapani
1893a1370d MDEV-22633 Assertion failed in prepare_inplace_alter_table_dict
prepare_inplace_alter_table_dict(): In the error handling, relax
a debug assertion for the case that we did not execute
dict_stats_wait_bg_to_stop_using_table() yet.
2020-05-20 11:13:02 +03:00
Marko Mäkelä
6b2c8cac1b MDEV-22258 Limit innodb_encryption_threads to 255
For no good reason, innodb_encryption_threads was limited to
4,294,967,295. Expectedly, the server would crash if such an
insane value was specified. Let us limit the maximum to 255.

The encryption threads are not doing much useful work.
They are basically only dirtying pages by performing
dummy writes via the redo log. The encryption key rotation
or the in-place addition or removal of encryption
will take place in the page cleaner.

In a quick test on a 20-core CPU (40 threads in total),
the sweet spot on an otherwise idle server seemed to be
innodb_encryption_threads=16 for the test
encryption.encrypt_and_grep. The new limit 255 should be
more than enough for even bigger servers.
2020-05-20 10:33:53 +03:00
Yury Kurlykov
d2900d917f
MDEV-22629 Remove fts_indexes field from struct fts_update_t (#1537)
fts_indexes field in fts_update_t never used. So replace fts_update_t
with doc_id_t in the code
2020-05-20 12:40:07 +05:30
Marko Mäkelä
dd95935e5b MDEV-22456 post-fix: Remove unused variable 2020-05-20 10:06:20 +03:00
Marko Mäkelä
2bf93a8fd6 Merge 10.3 into 10.4 2020-05-19 21:18:15 +03:00
Marko Mäkelä
79ed33c184 Merge 10.2 into 10.3 2020-05-19 17:05:05 +03:00
Marko Mäkelä
a8f044e1a4 MDEV-22456: Fix cmake -DWITH_INNODB_AHI=OFF
dict_index_remove_from_cache_low(): Add a missing #ifdef around
dict_index_t::freed().
2020-05-19 16:02:13 +03:00
Marko Mäkelä
cb437417d2 MDEV-19114 gcol.innodb_virtual_debug: Assertion n_fields>0 failed
This is a regression due to MDEV-16376
commit 8dc70c862b.
To make dict_index_t::detach_columns() idempotent,
we cleared dict_index_t::n_fields. But, this could
cause trouble with purge after a secondary index
creation failed (not even involving virtual columns).

A better way is to clear the dict_field_t::col pointers
that point to virtual columns that are being freed
due to aborting index creation on an index that depends
on a virtual column.

Note: the v_cols[] of an existing dict_table_t object will
never be modified. If any virtual columns are added or removed,
ha_innobase::commit_inplace_alter_table() would invoke
dict_table_remove_from_cache() and reload the table to dict_sys.
Index creation is a special case where the dict_index_t points
to virtual columns that do not yet exist in dict_table_t.
2020-05-19 16:02:13 +03:00
Marko Mäkelä
2e9f4cdc44 MDEV-21936 Assertion !btr_search_own... in btr_search_drop_page_hash_index
This is a regression due to the cleanup
commit 12f804acfa.

row_sel_open_pcur(): Remove the unnecessary parameter.
It suffices for us to acquire the adaptive hash index latch
only when btr_search_guess_on_hash() is called by
btr_cur_search_to_nth_level_func(), in
btr_pcur_open_with_no_init().

This code seems to be a relic from the times when there was
only one btr_search_latch, which was held in shared mode
for longer periods of time. Another relic of that era was
removed in commit e5980bf1b1.
This clean-up was missed when the btr_search_latch was split in
mysql/mysql-server/commit@ab17ab91ce18a47bb6c5c49e4dc0505ad488a448
(MySQL 5.7.8).
2020-05-19 15:43:35 +03:00
Marko Mäkelä
d2e96e492a Merge 10.4 into 10.5 2020-05-19 14:33:08 +03:00
Monty
fa0397849a Move c++ code from my_atomic.h to my_atomic_wrapper.h
This is because it breaks code that is using extern "C" when including
my_atomic, which is the case with ha_s3.cc
2020-05-19 14:07:34 +03:00
Vlad Lesin
0f9bfcc323 MDEV-22554: "mariabackup --prepare" exits with code 0 even though innodb
error is logged

The fix is to set flag in ib::error::~error() and check it in
mariabackup.

ib::error::error() is replaced with ib::warn::warn() in
AIO::linux_create_io_ctx() because of two reasons:

1) if we leave it as is, then mariabackup MTR tests will fail with --mem
option, because Linux AIO can not be used on tmpfs,

2) when Linux AIO can not be initialized, InnoDB falls back to simulated
AIO, so such sutiation is not fatal error, it should be treated as warning.
2020-05-19 11:25:56 +03:00
Marko Mäkelä
c93f8aca65 MDEV-22618 Assertion !dict_index_is_online_ddl ... in lock_table_locks_lookup
lock_table_locks_lookup(): Relax the assertion.
Locks must not exist while online secondary index creation is
in progress. However, if CREATE UNIQUE INDEX has not been committed
yet, but the index creation has been completed, concurrent DML
transactions may acquire record locks on the index. Furthermore,
such concurrent DML may cause duplicate key violation, causing
the DDL operation to be rolled back. After that, the online_status
may be ONLINE_INDEX_ABORTED or ONLINE_INDEX_ABORTED_DROPPED.

So, the debug assertion may only forbid the state ONLINE_INDEX_CREATION.
2020-05-19 10:42:56 +03:00
Monty
141cf43e61 Fixed assert in Aria on SHOW PROCEDURE STATUS
MDEV-18457 Assertion `(bitmap->map +
           (bitmap->full_head_size/6*6)) <= full_head_end failed

The problem was that full_head_size was not calculated correctly
in the case when insert_order was inforced, which is the case
for SHOW commands.
2020-05-19 03:42:54 +03:00
Marko Mäkelä
23047d3ed4 Merge 10.4 into 10.5 2020-05-18 17:30:02 +03:00
Marko Mäkelä
faf6d0ef3f Merge 10.3 into 10.4 2020-05-18 15:05:52 +03:00
Marko Mäkelä
386f168ab3 MDEV-22456 after-merge fix: introduce Atomic_relaxed
In the merge 9e6e43551f
we made Atomic_counter a more generic wrapper of std::atomic
so that dict_index_t would support the implicit assignment operator.

It is better to revert the changes to Atomic_counter and
instead introduce Atomic_relaxed as a generic wrapper to std::atomic.

Unlike Atomic_counter, we will not define operator++, operator+=
or similar, because we want to make the operations more explicit
in the users of Atomic_wrapper, because unlike loads and stores,
atomic read-modify-write operations always incur some overhead.
2020-05-18 15:02:55 +03:00
Marko Mäkelä
5e12aca57f Merge 10.2 into 10.3 2020-05-18 14:10:11 +03:00
Marko Mäkelä
5b6bcb59ac MDEV-22611 Assertion btr_search_enabled failed during buffer pool resizing
In commit ad6171b91c (MDEV-22456)
we removed the acquisition of the adaptive hash index latch
from the caller of btr_search_update_hash_ref().
The tests innodb.innodb_buffer_pool_resize_with_chunks
and innodb.innodb_buffer_pool_resize
would occasionally fail starting with 10.3,
due to MDEV-12288 causing more purge activity during the test.

btr_search_update_hash_ref(): After acquiring the adaptive hash index
latch, check that the adaptive hash index is still enabled on the page.
2020-05-18 14:04:31 +03:00