Commit graph

190387 commits

Author SHA1 Message Date
Nikita Malyavin
34f2be3b29 MDEV-16023 Unfortunate error message WARN_VERS_PART_FULL (partition <name> is full) when rotation time for the last interval passed
* remove one case of WARN_VERS_PART_FULL
2020-07-29 14:32:07 +10:00
Eugene Kosov
423de1e574 MDEV-23245 MDEV-22898 Still getting assertion failure in file data0type.cc line 67
Doesn't allow instant alter of a field which is a prefix part of some key

is_part_of_a_key_prefix(): I hope the name of the function is clear

ha_innobase::can_convert_string()
ha_innobase::can_convert_varstring()
ha_innobase::can_convert_blob(): it can't when field is_part_of_a_key_prefix()
2020-07-29 06:12:31 +03:00
Alexander Barkov
5b3b53ce36 MDEV-23311 CEILING() and FLOOR() convert temporal input to numbers, unlike ROUND() and TRUNCATE()
Fixing functions CEILING and FLOOR to return
- TIME for TIME input
- DATETIME for DATETIME and TIMESTAMP input
2020-07-28 23:29:08 +04:00
Jan Lindström
69cf6302f3 galera_var_notify_cmd still hangs. 2020-07-28 14:23:57 +03:00
Marko Mäkelä
05fa4558e0 MDEV-22110 InnoDB unnecessarily writes unmodified pages
At least since commit 6a7be48b1b
InnoDB appears to be invoking buf_flush_note_modification() on pages
that were exclusively latched but not modified in a mini-transaction.

MTR_MEMO_MODIFY, mtr_t::modify(): Define not only in debug code,
but also in release code. We will set the MTR_MEMO_MODIFY flag
on the earliest mtr_t::m_memo entry that we find.

MTR_LOG_NONE: Only use this mode in cases where the previous
mode will be restored before anything is modified in the mini-transaction.

MTR_MEMO_PAGE_X_MODIFY, MTR_MEMO_PAGE_SX_MODIFY: The allowed flag
combinations that include MTR_MEMO_MODIFY.

ReleaseBlocks: Only invoke buf_flush_note_modification()
on those buffer pool blocks on which mtr_t::set_modified()
and mtr_t::modify() were invoked.
2020-07-28 14:02:11 +03:00
Marko Mäkelä
cf3c3cce1d MDEV-23304 Insert into TEMPORARY TABLE fails to invoke mtr_t::set_modified()
In MDEV-21724 or possibly already in MDEV-12353 a bug was introduced to
the handling of temporary tables.

Whether or not redo log will be written, mtr_t::set_modified()
must be invoked to register any changes to a page.

page_cur_insert_rec_low(): Invoke mtr_t::set_modified() also
when skipping the redo log write.
2020-07-28 14:02:11 +03:00
Marko Mäkelä
3c3f172f17 MDEV-23308 CHECK TABLE attempts to access parent_right_page_no=FIL_NULL
mysql/mysql-server@e00ad49edc
which introduced WL#6326 to MySQL 5.7.2 added a buffer page
acquisition to CHECK TABLE code (solely for the purpose of
obeying the changed latching order), but failed to check that
a parent page actually exists. It would not necessarily exist in a
corrupted index where a parent page is missing pointer records
to child pages.
2020-07-28 13:00:59 +03:00
Marko Mäkelä
6307b17aa1 MDEV-20142 encryption.innodb_encrypt_temporary_tables failed in buildbot with wrong result
Let us read both encrypted temporary tables to increase the changes of
page flushing and eviction.
2020-07-28 13:00:59 +03:00
Daniel Black
940668f5cb MDEV-23137: aarch64, postfix - cmake include 2020-07-28 19:53:19 +10:00
Roman Nozdrin
2c5831b2c5 MCOL-4166 The solution to the minor upgrade issue
DEB package doesn't need expect and libreadline as dependencies

RPM packages now depends on jemalloc again
2020-07-28 09:48:17 +00:00
Daniel Black
6a70398c7a MDEV-23176: s3 curl library path fix
On FreeBSD (and possibly elsewhere) the FindPackage(curl)
may have found the curl library in a non-standard directory.

We use the exposed path as a library path to correct linking.
2020-07-28 10:08:14 +03:00
Oleksandr Byelkin
e08f87d527 fix obvious bugs hidden by current_select assigned to builtin select 2020-07-28 08:23:57 +02:00
Oleksandr Byelkin
c6eb21cd87 MDEV-21998: Server crashes in st_select_lex::add_table_to_list upon mix of KILL and sequences
Continue support the hack of current select equal builtin select if
selects stack is empty even after subselects.
2020-07-28 08:23:57 +02:00
Dan Solodko
459b87f6b4 MDEV-9911: NTILE must return an error when parameter is not stable 2020-07-28 06:35:32 +02:00
Daniel Black
3cb9131ac2 MDEV-23175: my_timer_milliseconds clock_gettime for multiple platfomrs
Small postfix to MDEV-23175 to ensure faster option on FreeBSD
and compatibility to Solaris that isn't high resolution.

ftime is left as a backup in case an implementation doesn't
contain any of these clocks.

FreeBSD
    $ ./unittest/mysys/my_rdtsc-t
    1..11
    # ----- Routine ---------------
    # myt.cycles.routine          :             5
    # myt.nanoseconds.routine     :            11
    # myt.microseconds.routine    :            13
    # myt.milliseconds.routine    :            11
    # myt.ticks.routine           :            17
    # ----- Frequency -------------
    # myt.cycles.frequency        :    3610295566
    # myt.nanoseconds.frequency   :    1000000000
    # myt.microseconds.frequency  :       1000000
    # myt.milliseconds.frequency  :           899
    # myt.ticks.frequency         :           136
    # ----- Resolution ------------
    # myt.cycles.resolution       :             1
    # myt.nanoseconds.resolution  :             1
    # myt.microseconds.resolution :             1
    # myt.milliseconds.resolution :             7
    # myt.ticks.resolution        :             1
    # ----- Overhead --------------
    # myt.cycles.overhead         :            26
    # myt.nanoseconds.overhead    :         19140
    # myt.microseconds.overhead   :         19036
    # myt.milliseconds.overhead   :           578
    # myt.ticks.overhead          :         21544
    ok 1 - my_timer_init() did not crash
    ok 2 - The cycle timer is strictly increasing
    ok 3 - The cycle timer is implemented
    ok 4 - The nanosecond timer is increasing
    ok 5 - The nanosecond timer is implemented
    ok 6 - The microsecond timer is increasing
    ok 7 - The microsecond timer is implemented
    ok 8 - The millisecond timer is increasing
    ok 9 - The millisecond timer is implemented
    ok 10 - The tick timer is increasing
    ok 11 - The tick timer is implemented
2020-07-28 12:44:26 +10:00
Daniel Black
cae4b3f811 rocksdb: FreeBSD disable jemalloc search
FreeBSD's inbuilt default jemalloc means its pointless
to do a package search on it. The paths are already set
by the system defaults.
2020-07-28 10:49:47 +10:00
Daniel Black
ba191f7e43 mtr: mysqld--help-aria test on OSX fail
Previous test failure:

--- /Users/travis/build/grooverdan/mariadb-server/mysql-test/main/mysqld--help-aria.result	2020-04-29 03:44:40.000000000 +0000
+++ /Users/travis/build/grooverdan/mariadb-server/mysql-test/main/mysqld--help-aria.reject	2020-04-29 04:19:13.000000000 +0000
@@ -1,3 +1,4 @@
+[Warning] Setting lower_case_table_names=2 because file system for /Users/travis/build/grooverdan/mariadb-server/mysql-test/var/4/mariadbd.1/data/ is case insensitive
 [ERROR] mariadbd: Can't lock aria aria_log_control for exclusive use, error: #. Will retry for 0 seconds
 [ERROR] Plugin 'Aria' init function returned error.
 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
@@ -9,4 +10,5 @@
 #
 # Check with existing directory
 #
+[Warning] Setting lower_case_table_names=2 because file system for /Users/travis/build/grooverdan/mariadb-server/mysql-test/var/tmp/4/help/ is case insensitive
 [Warning] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some options may be missing from the help text
2020-07-28 10:36:47 +10:00
Daniel Black
fecc6caa27 MDEV-22621: perfschema add FreeBSD include header for pthread_getthreadid_np 2020-07-28 10:32:07 +10:00
Daniel Black
715beee46a MDEV-23051: riscv64 fails build (atomics)
riscv64 fails to build because the use
of #include <atomic> needs to link with -latomic.

per https://github.com/riscv/riscv-gnu-toolchain/issues/183#issuecomment-253721765
2020-07-28 10:13:45 +10:00
Krunal Bauskar
d88ea26088 MDEV-23137: RocksDB: undefined reference to crc32c_arm64
RocksDB fails to build on arm64: undefined reference to
            `crc32c_arm64(unsigned int, unsigned char const*, unsigned int)'

MariaDB uses storage/rocksdb/build_rocksdb.cmake to compile RocksDB.
Said cmake missed adding crc32c_arm64 compilation target so if
machine native architecture supported crc32 then complier would enable
usage of function defined in crc32c_arm64 causing the listed error.

Added crc32c_arm64 complition target.

closes #1642
2020-07-28 10:06:29 +10:00
Daniel Black
186d9d0d72 MDEV-12474: rocksdb: mtr - rocksdb.concurrent_alter use sh
FreeBSD doesn't have bash installed by default and sh
has sufficient job control for this test.

$  mysql-test/mtr --mem --max-test-fail=30 --force --parallel=1 rocksdb.concurrent_alter
Logging: /home/dan/mariadb-server-10.5/mysql-test/mysql-test-run.pl  --mem --max-test-fail=30 --force --parallel=1 rocksdb.concurrent_alter
vardir: /usr/home/dan/build-mariadb-server-10.5/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/usr/home/dan/build-mariadb-server-10.5/mysql-test/var'...
 - symlinking 'var' to '/tmp/var_auto_P81m'
Checking supported features...
MariaDB Version 10.5.4-MariaDB
 - SSL connections supported

 - binaries built with wsrep patch
Collecting tests...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
rocksdb.concurrent_alter 'write_committed' [ pass ]  16348
rocksdb.concurrent_alter 'write_prepared' [ pass ]  16771
--------------------------------------------------------------------------
The servers were restarted 1 times
Spent 33.119 of 41 seconds executing testcases

Completed: All 2 tests were successful.

$ uname -a
FreeBSD freebsd 12.1-RELEASE-p6 FreeBSD 12.1-RELEASE-p6 GENERIC  amd64
2020-07-28 09:02:29 +10:00
Thirunarayanan Balathandayuthapani
a1f899a8ab MDEV-23233: Race condition for btr_search_drop_page_hash_index() in buf_page_create()
commit ad6171b91c (MDEV-22456)
introduced code to buf_page_create() that would lazily drop
adaptive hash index entries for an index that has been
evicted from the data dictionary cache.

Unfortunately, that call was missing adequate protection.
While the btr_search_drop_page_hash_index(block) was executing,
the block could be reused for something else.

buf_page_create(): If btr_search_drop_page_hash_index() must be
invoked, pin the block before releasing the buf_pool->page_hash lock,
so that the block cannot be grabbed by other threads.
2020-07-27 22:17:51 +05:30
Marko Mäkelä
fd9ca2a742 MDEV-23295 ROW_FORMAT mismatch in instant ALTER TABLE
An instant ADD/DROP/reorder column could create a dummy table
object with the wrong ROW_FORMAT when innodb_default_row_format
was changed between CREATE TABLE and ALTER TABLE.

prepare_inplace_alter_table_dict(): If we had promised that
ALGORITHM=INPLACE is supported, we must preserve the ROW_FORMAT.

dict_table_t::prepare_instant(): Add debug assertions to catch
ROW_FORMAT mismatch.

The rest of the changes are related to adding
Alter_inplace_info::inplace_supported to cache the return value of
handler::check_if_supported_inplace_alter().
2020-07-27 15:04:04 +03:00
Jan Lindström
b4c742108f Enable fixed test case. 2020-07-27 14:34:24 +03:00
Varun Gupta
a6410deba9 MDEV-18916: crash in Window_spec::print_partition() with decimals
Removed an unnecessary ifndef which was printing the window name for a named
window only in the case of debug build. The print() for the window function
should behave in the same way on both release and debug builds.
2020-07-27 13:53:33 +05:30
Alexey Botchkov
4968fdbcef MDEV-19918 Server hangs or crashes while trying to lock mutex when the
mutex was already locked upon startup with server_audit and orphan
records in mysql.plugin.

Preaquire auditing plugins before LOCK_plugin to awoid double locking.
2020-07-26 18:01:12 +04:00
Marko Mäkelä
05d62518fb MDEV-22651: Bogus assertion in dict_table_t::init_instant()
In commit 0e5a4ac253 (MDEV-15562)
we introduced a bogus debug assertion, demanding that dict_col_t::len
never exceed some maximum value. The intention was to match what
dict_index_add_col() is doing. But, the assignment field->fixed_len = 0
applies to dict_field_t::fixed_len, not dict_col_t::len!
2020-07-24 19:41:09 +03:00
Teemu Ollakka
3d76af0814 MDEV-22998 Free thd->mem_root at applier commit or rollback. 2020-07-24 19:33:45 +03:00
Jan Lindström
468e56bfde Add missing includes. 2020-07-24 19:25:32 +03:00
Thirunarayanan Balathandayuthapani
5f1ec5cbb7 MDEV-14711 Assertion `mode == 16 || mode == 12 || !fix_block->page.file_page_was_freed' failed in buf_page_get_gen (rollback requesting a freed undo page)
Problem:
=======
In buf_cur_optimistic_latch_leaves(), requesting a left block with BTR_GET
after releasing current block. But there is no guarantee that left block
could be still available.

Fix:
====

(1) In btr_cur_optimistic_latch_leaves(), replace the BUF_GET with
BUF_GET_POSSIBLY_FREED for fetching left block.
(2) Once InnoDB acquires left block, it should check FIL_PAGE_NEXT with
current block page number. If not, release cursor->left_block and return
false.
2020-07-24 20:32:27 +05:30
Thirunarayanan Balathandayuthapani
744919552c MDEV-23229 Read of Uninitialized memory during buffer pool resizing
commit b1ab211dee (MDEV-15053)
introduced the code to unfix the block earlier in buf_block_t::unfix().
After unfixing the block, InnoDB can withdraw the block from the
buffer pool and deallocate it while doing buffer pool resizing.
So subsequent assert could leads to uninitialized memory access of
block.

buf_block_t::unfix(): Unfix the block after checking the assert.
2020-07-24 20:30:06 +05:30
Jan Lindström
bec81db1c2 Update Galera global warning ignore list. 2020-07-24 15:17:35 +03:00
Teemu Ollakka
1e2a4ed7ed MDEV-21718 Assertion in wsrep::client_state::before_command().
An assertion

  `server_state_.rollback_mode() == wsrep::server_state::rm_async`

fired in before_command() when
- thread-handling was set to pool-of-threads and
- a BF abort happened between client session calls to
  wait_rollback_complete_and_acquire_ownership() and before_command().

This commit introduces a test case to reproduce the crash and
updates wsrep-lib submodule to fixed version.
2020-07-24 13:26:21 +03:00
mkaruza
a3a249c72f MDEV-15236: galera_ist_progress fails when trying to read transfer status
Fixed by new  recording test recording
2020-07-24 12:43:08 +03:00
sjaakola
c9928cc0fb MDEV-20928 mtr test galera.galera_var_innodb_disallow_writes test failure
The sporadic test hangs happen because of mutex dealock between innodb
background threads and two test connection executions.
The test sets variable innodb_disallow_writes, which blocks all writes
to filesyste. The test logic is to execute an INSERT, which should hang
because of filesytstem writes are blocked, and through another session
verify by SELECT that this hanging happens. The SELECT session will then
release innodb_disallow_writes blocking.

However, filesystem write  blocking affects also innodb background threads
and they may hang while keeping some other resources locked.
As an example, in one test hang situation, buffer pool access was blocked.
And, if buffer pool is blocked, the test connections will be blocked as well,
and the SELECT session will not be able to continue to release the
innodb_disallow_writes.

The fix in this commit is refactoring of the test logic.
The test will now set first innodb_disallow_writes blocking, and then record
a hash of data directory's filesystem contents. This works as checksum of the
state of data on the datadirectory.

Then some SQL load is tried on both nodes, these sessions will be blocking
due to frozen file system state. The test will have a short sleep to allow
innodb background threads to loop and possibly encounter innodb_disallow_writes
blocking as well.

After the sleep, the test will record file system checksun for the second time,
and then release the innodb_disallow-writes blocking.

Finally, the two checksums are compared, they should be identical to verify that
nothing was written on datadirectory during the test execution.

The checksum is implemented by md5sum hash over all files found in datadirectory
by find command. all these file hashes are hashed together by one more md5sum.

The test therefore depends on md5sum and find. find may work differently with some
OS distributions, e.g. freebsd may be problematic.
2020-07-24 12:21:47 +03:00
Jan Lindström
134a6a8d2f Silence unnecessary warning. 2020-07-24 12:05:39 +03:00
Alexey Yurchenko
8f3423fb5a Update wsrep-lib version: improved error logging and diagnostics 2020-07-24 12:05:39 +03:00
sjaakola
95132ade6d MDEV-20928 mtr test galera.galera_var_innodb_disallow_writes test failure
The sporadic test hangs happen because of mutex dealock between innodb
background threads and two test connection executions.
The test sets variable innodb_disallow_writes, which blocks all writes
to filesyste. The test logic is to execute an INSERT, which should hang
because of filesytstem writes are blocked, and through another session
verify by SELECT that this hanging happens. The SELECT session will then
release innodb_disallow_writes blocking.

However, filesystem write  blocking affects also innodb background threads
and they may hang while keeping some other resources locked.
As an example, in one test hang situation, buffer pool access was blocked.
And, if buffer pool is blocked, the test connections will be blocked as well,
and the SELECT session will not be able to continue to release the
innodb_disallow_writes.

The fix in this commit is refactoring of the test logic.
The test will now set first innodb_disallow_writes blocking, and then record
a hash of data directory's filesystem contents. This works as checksum of the
state of data on the datadirectory.

Then some SQL load is tried on both nodes, these sessions will be blocking
due to frozen file system state. The test will have a short sleep to allow
innodb background threads to loop and possibly encounter innodb_disallow_writes
blocking as well.

After the sleep, the test will record file system checksun for the second time,
and then release the innodb_disallow-writes blocking.

Finally, the two checksums are compared, they should be identical to verify that
nothing was written on datadirectory during the test execution.

The checksum is implemented by md5sum hash over all files found in datadirectory
by find command. all these file hashes are hashed together by one more md5sum.

The test therefore depends on md5sum and find. find may work differently with some
OS distributions, e.g. freebsd may be problematic.
2020-07-24 12:05:39 +03:00
mkaruza
4b4372af6a MDEV-22458: Server with WSREP hangs after INSERT, wrong usage of mutex 'LOCK_thd_data' and 'share->intern_lock' / 'lock->mutex'
Add `find_thread_by_id_with_thd_data_lock` which will be used only when killing thread.
This version needs to take `thd->LOCK_thd_data` lock.
2020-07-24 12:05:39 +03:00
mkaruza
6b8b7b1e8c MDEV-21905: Galera test galera_var_notify_cmd causes hang
Fixed wsrep_notify.sh script so it only reports status changes on
'joined', 'synced', 'donor'.
2020-07-24 12:05:39 +03:00
Jan Lindström
ba23e6d76f MDEV-18177 : Galera test failure on galera_autoinc_sst_mariabackup
Add wait_condition
2020-07-24 08:19:54 +03:00
Thirunarayanan Balathandayuthapani
b3b1c51e4d MDEV-23134 SEGV in dict_load_table_one during restart after server crash
Problem:
========
dict_load_table_one() doesn't handle the scenario where clustered
index page is FIL_NULL when DICT_ERR_IGNORE_INDEX_ROOT mode
is set.

Fix:
====
InnoDB should set the file_unreadable when it can't find the
clustered index root page.
2020-07-23 20:43:28 +05:30
Marko Mäkelä
1656ea28e8 MDEV-23244 ALTER TABLE…ADD PRIMARY KEY fails to flag duplicates
The fix of MDEV-13654 (commit ff81faf670)
wrongly caused ADD PRIMARY KEY to ignore duplicate PRIMARY KEY values
caused by concurrent DML transactions that had been started before the
ALTER TABLE operation (but did not access the table before the ALTER TABLE
started).

row_ins_duplicate_online(): Always report a duplicate key error
if DB_TRX_ID had been reset (it belongs to a transaction that had
started before the ALTER TABLE operation).
2020-07-23 17:41:44 +03:00
Tzachi Zidenberg
f843e215f3 aarch64: use compiler flag outline-atomics if available
outline-atomics compilation flag changes behaviour of builtin_atomics,
by adding runtime detection of LSE atomics. If these are supported, they
will be used. This gains LSE atomics use without hurting compatibility
with older aarch64 machines.
2020-07-23 15:08:54 +03:00
Tzachi Zidenberg
c76b45a524 MDEV-23249: Support aarch64 architecture timer
aarch64 timer is available to userspace via arch register.
clang's __builtin_readcyclecounter is wrong for aarch64 (reads the PMU
cycle counter instead of the archi-timer register), so we don't use it.

my_rdtsc unit-test on AWS m6g shows:
frequency: 121830845
resolution: 1
overhead: 1

This counter is not strictly increasing, but it is non-decreasing.
2020-07-23 15:07:13 +03:00
Thirunarayanan Balathandayuthapani
fe39d02f51 MDEV-20638 Remove the deadcode from srv_master_thread() and srv_active_wake_master_thread_low()
- Due to commit fe95cb2e40 (MDEV-16125),
InnoDB master thread does not need to call srv_resume_thread()
and therefore there is no need to wake up the thread.
Due to the above patch, InnoDB should remove the following dead code.

srv_check_activity(): Makes the parameter as in,out and returns the
recent activity value

innobase_active_small(): Removed

srv_active_wake_master_thread(): Removed

srv_wake_master_thread(): Removed

srv_active_wake_master_thread_low(): Removed

Simplify srv_master_thread() and remove switch cases, added the assert.

Replace srv_wake_master_thread() with srv_inc_activity_count()

INNOBASE_WAKE_INTERVAL: Removed
2020-07-23 16:23:20 +05:30
Varun Gupta
a18639f1a9 MDEV-23216: LONGTEXT column with collation doesn't sort
An overflow was happening with LONGTEXT columns, when the length was converted to the length
in the strxfrm form (mem-comparable keys).
Introduced a function to truncate the length to the max_sort_length before calculating
the length of the strxfrm form.
2020-07-23 15:30:29 +05:30
Jan Lindström
a8d5f57e9a Fix test cases
Changes to be committed:
	modified:   mysql-test/suite/galera_3nodes/t/GCF-354.test
	modified:   mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.test
2020-07-23 11:35:29 +03:00
Monty
ce699df905 thd->m_transaction_psi was not properly cleared for new connections
This happend when using XA transactions. I also added some extra asserts
to ensure that m_transactions are properly cleared.

Other things:
- Removed set_time() from THD::init_for_queries() as dispatch_command()
  is already doing that.
- Removed duplicate init_for_queries() from prepare_new_connection_state().
  The init_for_queries() functions should only be called once per
  connection.
2020-07-23 10:54:33 +03:00
Monty
dbcd3384e0 MDEV-7947 strcmp() takes 0.37% in OLTP RO
This patch ensures that all identical character sets shares the same
cs->csname.
This allows us to replace strcmp() in my_charset_same() with comparisons
of pointers. This fixes a long standing performance issue that could cause
as strcmp() for every item sent trough the protocol class to the end user.

One consequence of this patch is that we don't allow one to add a character
definition in the Index.xml file that changes the csname of an existing
character set. This is by design as changing character set names of existing
ones is extremely dangerous, especially as some storage engines just records
character set numbers.

As we now have a hash over character set's csname, we can in the future
use that for faster access to a specific character set. This could be done
by changing the hash to non unique and use the hash to find the next
character set with same csname.
2020-07-23 10:54:33 +03:00