Commit graph

188,801 commits

Author SHA1 Message Date
Marko Mäkelä
c7ba92372b Merge 10.4 into 10.5 2020-03-17 07:58:41 +02:00
Marko Mäkelä
023d986732 perfschema: remove unused variables 2020-03-17 07:56:40 +02:00
Marko Mäkelä
7b5aaaa554 Fix the build on big-endian systems 2020-03-17 07:51:53 +02:00
Alexander Barkov
bd6afd8b5e MDEV-21956 Add class Sys_var_charptr_fscs
Simplifying definitions on Sys_var_charptr*:

- Removing sys_var::is_os_charset
- Adding a new class Sys_var_charptr_fscs, to handle system
  variables with character_set_filesystem.
2020-03-17 07:44:23 +04:00
Daniel Black
c6db115ce6 Fix compile on all big endian related to innodb:ut_crc32_swap_byteorder
Move function ut_crc32_swap_byteorder to a non-x86 #ifdef area.

As its only used in BIGENDIAN, use #ifdefs around
ut_crc32_swap_byteorder.

Travis CI and Debian both include s390x in builds/test, which is big endian.

Fixes commit: 1312b4ebb6
2020-03-17 11:07:38 +11:00
Marko Mäkelä
9cc7edb1cf Cleanup: Remove an unused variable
log_write_buf(): Remove the unused variable write_header.
The dependent code was removed in
commit 0c2365c4e3.
That was dead or unnecessary code at least ever since
commit 9ef2d29ff4
removed the support for innodb_log_files_in_group>1.
2020-03-16 21:57:25 +02:00
Marko Mäkelä
097e2f9d0a MDEV-16188: Fix clang 10 -Wimplicit-int-float-conversion
mi_records_in_range(): Because HA_POS_ERROR cannot be accurately
represented in double (it will be off by one), add an explicit
cast to silence the warning.
2020-03-16 16:51:35 +02:00
Marko Mäkelä
b7f0644710 MDEV-5313: Fix GCC 10 -Wenum-conversion 2020-03-16 16:32:11 +02:00
Eugene Kosov
7dafab7569 MDEV-21949 key rotation for innodb_encrypt_log is not working in 10.5
log_t::has_encryption_key_rotation(): checks whether
key rotation is supported.

In a subsequent redo log format version, this key rotation
may be broken again.
2020-03-16 17:27:51 +03:00
Eugene Kosov
0c2365c4e3 cleanup redo log
Write log header just ones when file is created, instead of
writing to it on every log file wrap around.

log_t::file::write_header_durable(): this one writes to log header

log_write_buf(): this one stops writing to log header
2020-03-16 17:27:51 +03:00
Eugene Kosov
ce496d4f9e cleanup redo log
move statistics modification into one place
2020-03-16 17:27:51 +03:00
Marko Mäkelä
e5e95a287e Merge 10.3 into 10.4 2020-03-16 16:24:36 +02:00
Vladislav Vaintroub
56402e84b5 MDEV-21824 Crash in convert_error_message
restore check for client charset_info == NULL, which was previously
removed in MDEV-8844
2020-03-16 11:43:30 +01:00
Vladislav Vaintroub
92d61c2229 fix typo on non-Linux/Windows 2020-03-16 11:19:41 +01:00
Sergei Golubchik
b66745e9b9 fix a copy-paste error in 8fd654ce0e
that by a (un)lucky coincidence did not prevent 8fd654ce0e
from working properly
2020-03-16 10:47:39 +01:00
Sergei Golubchik
b55d960e43 fix a nondeterminism in perfschema.statement_program_nesting_event_check test
when selecting from perfschema, filter out statements
used by the test istself in wait_condition.inc, because they,
by design, can be repeated unpredictable number of times.
2020-03-16 10:33:38 +01:00
Marko Mäkelä
c7daabdb05 MDEV-13134/MDEV-21855: Add a test case 2020-03-16 10:10:33 +02:00
Marko Mäkelä
17080cbcf0 MDEV-21945 Assertion w==OPT failed in trx_purge_add_undo_to_history()
By default, when redo log is being written for modifying a persistent
data page, the data page must actually be changed. If the write can
sometimes be optimized away, then the template parameter w=mtr_t::OPT
should be passed in order to silence the debug assertion failure.

InnoDB undo log pages can be reused without properly freeing or
initializing them in between. In particular, the undo log header
page field TRX_UNDO_TRX_NO could have been part of an undo log
record page, and those bytes could accidentally have the desired
value when the page is reused as an undo log header page of
another transaction.

Because the function trx_undo_set_state_at_finish() always changes
the TRX_UNDO_STATE of the page, and because recovery is only reading
TRX_UNDO_TRX_NO for pages that either have the correct TRX_UNDO_STATE
or, in trx_rseg_array_init(), are attached to the TRX_SYS page, the
garbage values in TRX_UNDO_TRX_NO do not seem to cause a problem.

This assertion failure affects debug builds only.
2020-03-16 08:58:54 +02:00
Sergei Golubchik
9bd583ce1f MDEV-21942 Building 10.5 requires Internet access
Force correct PCRE2 linking in the official binaries.
System pcre2 in RPM/DEB, bundled in bintars.
2020-03-16 01:13:01 +01:00
Sergei Golubchik
b6b6980686 MDEV-21942 Building 10.5 requires Internet access
fix build requirements for debian
2020-03-16 01:13:01 +01:00
Sergei Golubchik
79499b597a update the test result for new perfschema 2020-03-16 01:13:01 +01:00
Sergei Golubchik
8fd654ce0e MDEV-21943 reduce the binary tarball size
strip all client binaries (that is, not mysqld) in bintars
2020-03-16 01:13:01 +01:00
Sergei Golubchik
47e220a3a7 MDEV-21943 reduce the binary tarball size
in mysql_release builds only build embedded for rpm and deb
but not for bintar
2020-03-16 01:13:01 +01:00
Sergei Golubchik
0afccbf7b8 restore stack traces that were broken by ebfe8c4e0e 2020-03-16 01:13:01 +01:00
Kentoku SHIBA
2fde97119e Merge branch '10.5' of github.com:MariaDB/server into 10.5 2020-03-16 08:42:50 +09:00
Kentoku SHIBA
5929e222e4 fix evaluating bitmap issue in spider 2020-03-16 08:39:49 +09:00
Otto Kekäläinen
c8388de2fd Fix various spelling errors
e.g.
- dont -> don't
- occurence -> occurrence
- succesfully -> successfully
- easyly -> easily

Also remove trailing space in selected files.

These changes span:
- server core
- Connect and Innobase storage engine code
- OQgraph, Sphinx and TokuDB storage engines

Related to MDEV-21769.
2020-03-16 00:10:50 +02:00
Vladislav Vaintroub
3c57693ff1 MDEV-21534 - Improve innodb redo log group commit performance
Instrument new synchronization primitive with thd_wait_begin/end
to inform threadpool about waits.

This considerably improve performance on write benchmarks
(e.g sysbench update_index) with generic threadpool, of course the cost is
possibility of many newly created threads.
2020-03-15 21:40:11 +01:00
Varun Gupta
637c17588a MDEV-21922: Allow packing addon fields even if they don't honour max_length_for_sort_data
Addon fields will be packed if the length of addon fields is greater
than max_length_for_sort_data.
2020-03-15 23:48:51 +05:30
Andrei Elkin
345e21d2eb MDEV-742 test correction.
Fixed XA-ROLLBACK not to write into binlog when XA-prepare run
in sql_log_bin-OFF environment. (Two tests affected).
2020-03-15 14:14:35 +02:00
Sergey Vojtovich
8e5ae4e4df Test case fix: sort XA RECOVER result
Part of
MDEV-742 - XA PREPAREd transaction survive disconnect/server restart
2020-03-15 12:52:53 +04:00
Andrei Elkin
c8ae357341 MDEV-742 XA PREPAREd transaction survive disconnect/server restart
Lifted long standing limitation to the XA of rolling it back at the
transaction's
connection close even if the XA is prepared.

Prepared XA-transaction is made to sustain connection close or server
restart.
The patch consists of

    - binary logging extension to write prepared XA part of
      transaction signified with
      its XID in a new XA_prepare_log_event. The concusion part -
      with Commit or Rollback decision - is logged separately as
      Query_log_event.
      That is in the binlog the XA consists of two separate group of
      events.

      That makes the whole XA possibly interweaving in binlog with
      other XA:s or regular transaction but with no harm to
      replication and data consistency.

      Gtid_log_event receives two more flags to identify which of the
      two XA phases of the transaction it represents. With either flag
      set also XID info is added to the event.

      When binlog is ON on the server XID::formatID is
      constrained to 4 bytes.

    - engines are made aware of the server policy to keep up user
      prepared XA:s so they (Innodb, rocksdb) don't roll them back
      anymore at their disconnect methods.

    - slave applier is refined to cope with two phase logged XA:s
      including parallel modes of execution.

This patch does not address crash-safe logging of the new events which
is being addressed by MDEV-21469.

CORNER CASES: read-only, pure myisam, binlog-*, @@skip_log_bin, etc

Are addressed along the following policies.
1. The read-only at reconnect marks XID to fail for future
   completion with ER_XA_RBROLLBACK.

2. binlog-* filtered XA when it changes engine data is regarded as
   loggable even when nothing got cached for binlog.  An empty
   XA-prepare group is recorded. Consequent Commit-or-Rollback
   succeeds in the Engine(s) as well as recorded into binlog.

3. The same applies to the non-transactional engine XA.

4. @@skip_log_bin=OFF does not record anything at XA-prepare
   (obviously), but the completion event is recorded into binlog to
   admit inconsistency with slave.

The following actions are taken by the patch.

At XA-prepare:
   when empty binlog cache - don't do anything to binlog if RO,
   otherwise write empty XA_prepare (assert(binlog-filter case)).

At Disconnect:
   when Prepared && RO (=> no binlogging was done)
     set Xid_cache_element::error := ER_XA_RBROLLBACK
     *keep* XID in the cache, and rollback the transaction.

At XA-"complete":
   Discover the error, if any don't binlog the "complete",
   return the error to the user.

Kudos
-----
Alexey Botchkov took to drive this work initially.
Sergei Golubchik, Sergei Petrunja, Marko Mäkelä provided a number of
good recommendations.
Sergei Voitovich made a magnificent review and improvements to the code.
They all deserve a bunch of thanks for making this work done!
2020-03-14 22:45:48 +02:00
Monty
5754ea2eca Fixed compiler failures with gcc 7.4.1 and new my_malloc code 2020-03-14 15:24:13 +02:00
Sergei Golubchik
41cba6c90b MDEV-21920 binlog_encryption.rpl_gtid_basic test failure with --ps
revert e74c1c9ece to restore 2bbcf9a19c
2020-03-14 09:56:00 +01:00
Sergei Golubchik
91d1588d30 Merge branch 'github/10.5' into 10.5 2020-03-14 09:52:35 +01:00
Sergei Golubchik
c4f3e37b0c fix a race condition in the perfschema.transaction_nested_events 2020-03-14 09:51:52 +01:00
Sergei Golubchik
92c05a391a fix a race condition in the main.grant_kill test
also remove redundant --connection commands
2020-03-14 09:51:52 +01:00
Sergei Golubchik
df25d67d5f perfschema test formatting. Use --echo # 2020-03-14 09:51:36 +01:00
Sergei Golubchik
57de4def85 MDEV-21222 mariabackup.incremental_backup failed with memory allocation failure
mariabackup tries to allocate a buffer of page_size*page_size/4 size.
for 64k page it means 1Gb, which doesn't work very well on 32-bit builders.

Skip the 64k page test on 32bit.
2020-03-14 09:51:36 +01:00
Sergei Golubchik
422ba20591 mtr sets MYSQLTEST_REAL_VARDIR when MYSQLTEST_VARDIR is a symlink
this fixes main.mysqld--defaults-file failure with --mem
2020-03-14 09:51:36 +01:00
Sergei Golubchik
2b3f6ab417 MDEV-21599 plugins.server_audit fails sporadically in buildbot 2020-03-14 09:48:46 +01:00
Eugene Kosov
774fe8969a cleanup redo log 2020-03-14 00:52:21 +03:00
Sergey Vojtovich
78cc9c9ebf Pre-MDEV-742 InnoDB fixes
1. Refactored innobase_close_connection(). Transaction must've already
been rolled back by this time. We should expect only transactions in the
PREPARED state when MDEV-742 is done.

2. Added missing put_pins() to trx_disconnect_prepared(). Missing
put_pins() wasn't a problem because trx_disconnect_prepared() is a dead
code. But it will get revived in the main MDEV-742 patch.

3. Fixed missing reset of trx->mysql_log_file_name when RW transaction
didn't emit any log records (zero-modification RW). The problem was
detected by ASAN when disconnected XA transaction was trying to make
use of inherited mysql_log_file_name pointing into binlog data of
detached THD.

This missing reset also had user-visible side effect, when
trx_sys_print_mysql_binlog_offset() would report binlog position
not of the most recently committed transaction.

One of possible scenarios that is expected to misbehave is as following:

  thr1> CREATE TABLE t1(a INT) ENGINE=InnoDB;
  thr1> INSERT INTO t1 VALUES(1);
  thr1> BEGIN;
  thr1> UPDATE t1 SET a=1
  thr1> COMMIT; -- zero-modification, misses to reset mysql_log_file_name

  thr2> BEGIN;
  thr2> INSERT INTO t1 VALUES(2);
  thr2> COMMIT;

  thr1> BEGIN;
  thr1> do-some-real-changes;
  thr1> ROLLBACK; -- will store binlog pos from previous COMMIT in thr1?

In this case it means if binlog is replayed from position reported by
trx_sys_print_mysql_binlog_offset(), t1 will end up with two records
containing '2'.

Part of
MDEV-742 - XA PREPAREd transaction survive disconnect/server restart
2020-03-13 15:44:42 +04:00
Sergey Vojtovich
662d8a8638 Extended debug_sync_control life time
It now lives from THD constructor to THD destructor. Reset before THD is
released to a cache. Change user doesn't reset debug_sync_control anymore.

Needed to be able to make use of DEBUG_SYNC() at later stages like
ha_close_connection().
2020-03-13 15:44:42 +04:00
Marko Mäkelä
5fe87ac413 Merge 10.2 into 10.3 2020-03-13 12:31:55 +02:00
Marko Mäkelä
ed21202a14 Fix GCC 10.0 -Wstringop-overflow
myrg_open(): Reduce the scope of the variable 'end' and
simplify the code.

For some reason, I got no warning for this code in the 10.2
branch, only 10.3 or later.

The ENGINE=MERGE is covered by the tests main.merge, main.merge_debug,
and main.merge-big.
2020-03-13 12:09:19 +02:00
Sujatha
d9d3c222ca MDEV-10047: table-based master info repository
Problem:
=======
When we upgrade from "mysql" to "mariadb" if slave is using repositories as
tables their data is completely ignored and no warning is issued in error log.

Fix:
===
"mysql_upgrade" test should check for the presence of data in
"mysql.slave_master_info" and "mysql.slave_relay_log_info" tables. When tables
have some data the upgrade script should report a warning which hints users
that the data in repository tables will be ignored.
2020-03-13 14:00:03 +05:30
Thirunarayanan Balathandayuthapani
c58686447f MDEV-21903 FTS optimize thread aborts during shutdown
- This issue was caused by 5e62b6a5e0.
fts_optimize_callback() should free fts_optimize_wq and make it as NULL
when it receives FTS_MSG_STOP message. So that subsequent
fts_optimize_callback() doesn't fail with segmentation fault.
2020-03-13 13:52:07 +05:30
Marko Mäkelä
e74c1c9ece Update libmariadb to fix GCC -Wstringop-truncation 2020-03-13 10:12:32 +02:00
Marko Mäkelä
fbe662a503 MDEV-15058: Remove buf_pool_get_dirty_pages_count()
Starting with commit 1a6f708ec5
the function buf_pool_get_dirty_pages_count() is only used
in a debug check. It was dead code for non-debug builds.

buf_flush_dirty_pages(): Perform the debug check inline,
and replace the assertion
	ut_ad(first || buf_pool_get_dirty_pages_count(id) == 0);
with another one that is executed while holding the mutexes:
	ut_ad(id != bpage->id.space());
2020-03-13 10:09:15 +02:00