Commit graph

9142 commits

Author SHA1 Message Date
Kristian Nielsen
565960816e Merge MDEV-8354 into 10.1 2015-06-24 17:18:12 +02:00
Kristian Nielsen
8af5ab405a Merge MDEV-8354 into 10.0 2015-06-24 16:53:41 +02:00
Kristian Nielsen
b89de2b2ce MDEV-8354: out-of-order error with --gtid-ignore-duplicates and row-based replication
The --gtid-ignore-duplicates option was not working correctly with row-based
replication. When a row event was completed, but before committing, there
was a small window where another multi-source SQL thread could wrongly try
to re-execute the same transaction, without properly ignoring the duplicate
GTID. This would lead to duplicate key error or out-of-order GTID error or
similar.

Thanks to Matt Neth for reporting this and giving an easy way to reproduce
the issue.
2015-06-24 16:52:50 +02:00
Nirbhay Choubey
70714d3597 Merge branch '5.5-galera' into 10.0-galera 2015-06-23 16:46:12 -04:00
Jan Lindström
b7ff2f1b59 MDEV-7472: Implementation of user statements for handling the xtradb changed page bitmaps
Introduce a new dummy INFORMATION_SCHEMA.CHANGED_PAGE_BITMAPS table to XtraDB
with reset_table callback to allow FLUSH NO_WRITE_TO_BINLOG CHANGED_PAGE_BITMAPS
to be called from innobackupex.
2015-06-23 14:46:06 +03:00
Sergey Vojtovich
84568c2965 MDEV-8030 - Apc_target::disable() locks mutex twice
Moved Apc_target::destroy(), Apc_target::enable() and Apc_targe::disable()
definitions to my_apc.h so that they can be inlined.

Apc_targe::disable() now calls Apc_target::process_apc_requests() only if
there're APC requests. This saves one pthread_mutex_lock() call.

Overhead change:
Apc_target::disable              0.04% -> out of radar
Apc_target::enable               0.03% -> out of radar
Apc_target::process_apc_requests 0.02% -> out of radar
pthread_mutex_lock               0.43% -> 0.42%
pthread_mutex_unlock             0.26% -> 0.25%
2015-06-23 09:54:36 +04:00
Nirbhay Choubey
46024098be Merge tag 'mariadb-10.0.20' into 10.0-galera 2015-06-21 23:54:55 -04:00
Nirbhay Choubey
327409443f Merge tag 'mariadb-5.5.44' into 5.5-galera 2015-06-21 21:50:43 -04:00
Nirbhay Choubey
fc716dc5a5 MDEV-8260 : Issues related to concurrent CTAS
* Wait for aborted thd (victim) to release MDL locks
* Skip aborting an already aborted thd
* Defer setting OK status in case of CTAS
* Minor cosmetic changes
* Added a test case
2015-06-19 19:25:15 -04:00
Annamalai Gurusami
db2ed27e0e Bug #20762798 FK DDL: CRASH IN DICT_FOREIGN_REMOVE_FROM_CACHE
Problem:

If we add a referential integrity constraint with a duplicate
name, an error occurs.  The foreign key object would not have
been added to the dictionary cache.  In the error path, there
is an attempt to remove this foreign key object. Since this
object is not there, the search returns a NULL result.
De-referencing the null object results in this crash.

Solution:

If the search to the foreign key object failed, then don't
attempt to access it.

rb#9309 approved by Marko.
2015-06-19 10:17:52 +05:30
Nirbhay Choubey
8c44fd63ac MDEV-8239 : Idle threads post-execution end up in closing tables state
Set thd's state to 'committed' only after it has done closing tables
(called indirectly by relay_group_info::cleanup_context()).
2015-06-19 00:17:25 -04:00
Jan Lindström
eb2c170bb0 MDEV-8303; Dumping buffer pool noisy in the logs.
Added new dynamic configuration variable innodb_buf_dump_status_frequency
to configure how often buffer pool dump status is printed in the logs.
A number between [0, 100] that tells how oftern buffer pool dump status
in percentages should be printed. E.g. 10 means that buffer pool dump
status is printed when every 10% of number of buffer pool pages are
dumped. Default is 0 (only start and end status is printed).
2015-06-18 12:20:21 +03:00
Sergei Golubchik
b56ad494b4 MDEV-8287 DROP TABLE suppresses all engine errors
in ha_delete_table()
* only convert ENOENT and HA_ERR_NO_SUCH_TABLE to warnings
* only return real error codes (that is, not ENOENT and
  not HA_ERR_NO_SUCH_TABLE)
* intercept HA_ERR_ROW_IS_REFERENCED to generate backward
  compatible ER_ROW_IS_REFERENCED

in mysql_rm_table_no_locks()
* no special code to handle HA_ERR_ROW_IS_REFERENCED
* no special code to handle ENOENT and HA_ERR_NO_SUCH_TABLE
* return multi-table error ER_BAD_TABLE_ERROR <table list> only
  when there were many errors, not when there were many
  tables to drop (but only one table generated an error)
2015-06-16 23:58:40 +02:00
Sergei Golubchik
985e430c0f after-merge fixes
in innobase: compilation error on windows
other changes: perfschema merge followup
2015-06-16 23:55:56 +02:00
Sergei Golubchik
ede08808e9 Merge branch 'merge-perfschema-5.6' into 10.0 2015-06-16 12:47:58 +02:00
Sergei Golubchik
3c3724991e 5.6.25 2015-06-16 11:00:33 +02:00
Sergei Golubchik
3288f2667a include the correct IPv6 check in perfschema tests 2015-06-15 11:07:59 +02:00
Sergei Golubchik
a453a28040 MDEV-8083 MTR is broken on systems with IPv6 disabled
disable IPv6 globally in mysql-test, only use it
in dedicated IPv6 tests (where it is enabled per-test)
2015-06-15 11:07:58 +02:00
Kristian Nielsen
6a92fa4be5 Merge branch 'mdev8294' into 10.1 2015-06-15 08:28:04 +02:00
Kristian Nielsen
f69f3db7f3 Merge branch 'mdev8294' into 10.0 2015-06-15 08:25:09 +02:00
Kristian Nielsen
93c039dd3c MDEV-8294: Inconsistent behavior of slave parallel threads at runtime
Follow-up patch to temporarily avoid a sporadic failure in the test
rpl.rpl_000011 due to MDEV-8301.

There is a window during thread exit where the global status is
counted incorrectly - the contribution for the exiting thread is
counted twice. The patch for MDEV-8294 made this window visible to the
test case rpl.rpl_000011, causing it to sporadically fail. Temporarily
silence this with a wait for the expected value; can be removed once
MDEV-8294 is fixed.
2015-06-15 08:13:40 +02:00
Jan Lindström
e2879ac526 MDEV-7881: InnoDB Logfile size - misleading error message
Added test case to show that correct error message is printed when
log file size is too small for big blob.
2015-06-14 08:14:28 +03:00
Sergei Golubchik
e85b6615d8 Merge branch 'bb-10.0-serg' into 10.0 2015-06-12 08:00:48 +02:00
Sergei Golubchik
810cf362ea Merge branch '5.5' into 10.0 2015-06-11 20:20:35 +02:00
Sergei Golubchik
d199a0ffb0 more renames after tokudb merge 2015-06-11 17:47:52 +02:00
Kristian Nielsen
b1b0db294f Merge MDEV-8294 into 10.1 2015-06-10 12:42:18 +02:00
Kristian Nielsen
36f37a4890 Merge MDEV-8294 into 10.0 2015-06-10 12:01:06 +02:00
Kristian Nielsen
682ed005c5 MDEV-8294: Inconsistent behavior of slave parallel threads at runtime
There were some cases where the slave SQL thread could stop without
the pool of parallel replication worker threads being correctly
de-activated.
2015-06-10 11:57:42 +02:00
Sergey Vojtovich
80f6b22593 MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with disabled
keys

Fixed that OPTIMIZE TABLE against MyISAM/Aria table may write uninitialized key
root position for disabled keys.
2015-06-09 23:24:03 +04:00
Nirbhay Choubey
f965cae5fb MDEV-7110 : Add missing MySQL variable log_bin_basename and log_bin_index
Add log_bin_index, log_bin_basename and relay_log_basename system
variables. Also, convert relay_log_index system variable to
NO_CMD_LINE and implement --relay-log-index as a command line
option.
2015-06-09 13:38:29 -04:00
Alexander Barkov
92b365981b MDEV-7268 Column of table cannot be converted from type 'decimal(0,?)' to type ' 'decimal(10,7)'
Changing the error message to:
 "...from type 'decimal(0,?)/*old*/' to type ' 'decimal(10,7)'..."
So it's now clear that the master data type is OLD decimal.
2015-06-09 12:05:06 +04:00
Sergei Golubchik
a4d93e07cc MDEV-8050 sphinx test cases cannot run with sphinxsearch-2.2.6
remove/replace deprecated options
2015-06-08 21:48:19 +02:00
Alexey Botchkov
1707cfc9ef MDEV-8211 plugins.server_audit fails sporadically in buildbot.
More fixes to assure the order of queries in the log.
2015-06-08 21:55:52 +05:00
Alexey Botchkov
87088b91f7 MDEV-8211 plugins.server_audit fails sporadically in buildbot.
This test also should be fixed - delay added so the connection
  event doesn't happen before the query.
2015-06-08 21:44:13 +05:00
Alexey Botchkov
96b37035e4 MDEV-8211 plugins.server_audit fails sporadically in buildbot.
Connection event can happen before the query ends. Added a delay to
   confirm the order.
2015-06-08 21:40:17 +05:00
Alexey Botchkov
69ed429aff MDEV-7500 thread_handling option in my.cnf is not passing "connect events" to audit plugin.
The MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT() call moved to the login_connection()
  function. So that it'll be invoked in any thread handling mode.
2015-06-08 12:09:13 +05:00
Alexey Botchkov
1ae05db49c MDEV-8078 Memory disclosure/buffer overread on audit plugin.
If the SET PASSWORD query doesn't have the password string,
        the parsing of it can fail. It manifested first in MySQL 5.6 as
        it started to hide password lines sent to the plugins.
        Fixed by checking for that case.
2015-06-07 15:40:42 +05:00
Alexey Botchkov
db0ecf2662 MDEV-8032 [PATCH] audit plugin - csv output broken.
Symbols like TAB or NEWLINE should be escaped, which was
        forgotten in one place.
2015-06-06 19:12:44 +05:00
Sergei Golubchik
9a3b975da6 Merge branch '5.5' into bb-5.5-serg 2015-06-05 09:51:17 +02:00
Sergei Golubchik
ae0c576d46 Merge branch 'merge/merge-xtradb-5.5' into bb-5.5-serg
update tests
2015-06-05 02:14:49 +02:00
Sergei Golubchik
f84f577aa1 Merge tag 'mysql-5.5.44' into bb-5.5-serg 2015-06-05 02:06:51 +02:00
Alexander Barkov
9da8a8f946 MDEV-7269 mysqlbinlog Don't know how to handle column type=0 meta=0 (0000)#
MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
2015-06-04 18:49:12 +04:00
Jan Lindström
f7002c05ae MDEV-8250: InnoDB: Page compressed tables are not compressed and compressed+encrypted tables cause crash
Analysis: Problem is that both encrypted tables and compressed tables use
FIL header offset FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION to store
required metadata. Furhermore, for only compressed tables currently
code skips compression.

Fixes:
- Only encrypted pages store key_version to FIL header offset FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
  no need to fix
- Only compressed pages store compression algorithm to FIL header offset FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
  no need to fix as they have different page type FIL_PAGE_PAGE_COMPRESSED
- Compressed and encrypted pages now use a new page type FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED and
  key_version is stored on FIL header offset FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION and compression
  method is stored after FIL header similar way as compressed size, so that first
  FIL_PAGE_COMPRESSED_SIZE is stored followed by FIL_PAGE_COMPRESSION_METHOD
- Fix buf_page_encrypt_before_write function to really compress pages if compression is enabled
- Fix buf_page_decrypt_after_read function to really decompress pages if compression is used
- Small style fixes
2015-06-04 09:47:06 +03:00
Sergei Golubchik
7b05650c7d Merge tag 'tokudb-engine/tokudb-7.5.7' into 5.5 2015-06-03 20:24:51 +02:00
Sergei Golubchik
cd70bed05e fix for 32-bit tests 2015-06-03 11:12:50 +02:00
Sergei Golubchik
8e7d6652ad CRLF->LF 2015-06-02 22:07:47 +02:00
Nirbhay Choubey
6d5b723bdc Merge branch '5.5-galera' into 10.0-galera 2015-06-02 13:27:39 -04:00
Sergei Golubchik
51d67633ef AES-GCM support in file_key_management plugin 2015-06-02 19:00:23 +02:00
Sergei Golubchik
487e5f4590 file_key_management plugin: complain if key id 1 is not found
and don't recommend aes_ctr if it's unavailable
2015-06-02 19:00:23 +02:00
Sergei Golubchik
d9340d6c8e MDEV-8126 encryption for temp files
IO_CACHE tempfiles encryption
2015-06-02 18:53:37 +02:00
Sergei Golubchik
8f92a70e21 update for 32-bit, again 2015-06-02 09:26:16 +02:00
Sergei Golubchik
2133230305 avoid ulong sysvars, prefer uint or ulonglong
ulong is not portable - different width on different architectures
2015-06-01 21:31:31 +02:00
Sergei Golubchik
fce4ab0ab4 generalize ER_TABLE_NEEDS_UPGRADE to work for views too 2015-06-01 16:01:23 +02:00
Sergei Golubchik
5091a4ba75 Merge tag 'mariadb-10.0.19' into 10.1 2015-06-01 15:51:25 +02:00
Sergei Golubchik
c6b4212821 temporarily disable failing test 2015-05-30 09:16:06 +02:00
Sergei Golubchik
c1c22c043b update test results
(yes, we no longer add all variables to sys_vars suite!)
2015-05-29 21:23:52 +02:00
Nirbhay Choubey
903cfde149 MDEV-7067: Server outputs Galera (WSREP) information, even if Galera is disabled
* mysqld_safe: Since wsrep_on variable is mandatory in 10.1, skip wsrep
position recovery if its OFF.
* mysqld: Remove "-wsrep" from server version
* mysqld: Remove wsrep patch version from @@version_comment
* mysqld: Introduce @@wsrep_patch_version
2015-05-29 11:26:46 -04:00
Sergei Golubchik
34e01f80e4 restore innodb_encrypt_tables validation function
that was apparently lost in 20c23048:

  commit 20c23048c1
  Author: Jan Lindström <jan.lindstrom@mariadb.com>
  Date:   Sun May 17 14:14:16 2015 +0300

      MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing

This also reverts 8635c4b4:

  commit 8635c4b4e6
  Author: Jan Lindström <jan.lindstrom@mariadb.com>
  Date:   Thu May 21 11:02:03 2015 +0300

      Fix test failure.
2015-05-28 14:41:48 +02:00
Jan Lindström
979c5049ef MDEV-8242: encryption.innodb_page_encryption_key_change fails in buildbot
Forgot that echo will also expand variables and path might be different.
2015-05-28 07:52:27 +03:00
Jan Lindström
a25ccd4f83 MDEV-8238: Tables with encryption=yes using file_key_management plugin are not encrypted
Analysis: Problem was that encryption was skipped.

Fixed by making sure that tables with ENCRYPTED=YES are encrypted.
2015-05-27 16:52:36 +03:00
Jan Lindström
2bea4bd9ed MDEV-8233: InnoDB: Assertion failure in fil_page_decompress with encrypted tables
Analysis: Problem was that used compression method needs to be stored
to the page.

Fixed by storing compression method after key_version to the page.
2015-05-27 15:34:10 +03:00
Jan Lindström
58d7e35f59 Fixed innodb_scrub_background test. 2015-05-27 11:00:46 +03:00
Kristian Nielsen
903f8dc72d Merge MDEV-8147 into 10.1 2015-05-26 15:03:22 +02:00
Kristian Nielsen
f7385980d3 Merge MDEV-8147 into 10.0 2015-05-26 13:15:57 +02:00
Kristian Nielsen
e5f1e841dc MDEV-8147: Assertion `m_lock_type == 2' failed in handler::ha_close() during parallel replication
When the slave processes the master restart format_description event,
parallel replication needs to complete any prior events before processing
the restart event (which closes temporary tables and such stuff).

This happens in wait_for_workers_idle(), however it was not waiting long
enough. The wait was using wait_for_prior_commit(), but at that points table
can still be open. This lead to assertion in this case.

So change wait_for_workers_idle() to wait until all worker threads have
reached finish_event_group(), at which point all tables should have been
closed.
2015-05-26 13:04:15 +02:00
Jan Lindström
b3aece9b99 MDEV-8209: encryption.encrypt_and_grep fails in buildbot and outside
Problem is that when encryption/decryption is marked done on memory
cache, dirty pages might not be physically written.

Fixed by adding sleep on test.
2015-05-25 09:38:47 +03:00
Jan Lindström
8635c4b4e6 Fix test failure. 2015-05-21 11:02:03 +03:00
Jan Lindström
3e55ef26d4 MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1
Make sure that when we publish the crypt_data we access the
memory cache of the tablespace crypt_data. Make sure that
crypt_data is stored whenever it is really needed.

All this is not yet enough in my opinion because:

sql/encryption.cc has DBUG_ASSERT(scheme->type == 1) i.e.
crypt_data->type == CRYPT_SCHEME_1

However, for InnoDB point of view we have global crypt_data
for every tablespace. When we change variables on crypt_data
we take mutex. However, when we use crypt_data for
encryption/decryption we use pointer to this global
structure and no mutex to protect against changes on
crypt_data.

Tablespace encryption starts in fil_crypt_start_encrypting_space
from crypt_data that has crypt_data->type = CRYPT_SCHEME_UNENCRYPTED
and later we write page 0 CRYPT_SCHEME_1 and finally whe publish
that to memory cache.
2015-05-20 14:10:07 +03:00
Jan Lindström
80333ad847 Add missing requirement to test case and remove unnecessary output. 2015-05-20 07:57:55 +03:00
Jan Lindström
20c23048c1 MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
Analysis: Problem was that tablespaces not encrypted might not have
crypt_data stored on disk.

Fixed by always creating crypt_data to memory cache of the tablespace.

MDEV-8138: strange results from encrypt-and-grep test

Analysis: crypt_data->type is not updated correctly on memory
cache. This caused problem with state tranfer on
encrypted => unencrypted => encrypted.

Fixed by updating memory cache of crypt_data->type correctly based on
current srv_encrypt_tables value to either CRYPT_SCHEME_1 or
CRYPT_SCHEME_UNENCRYPTED.
2015-05-18 13:28:13 +03:00
Nirbhay Choubey
0bfae356d4 MDEV-8166 : Adding index on new table from select crashes Galera cluster
In wsrep, CTAS should be handled like a regular transaction.
Added a test case.
2015-05-16 11:11:26 -04:00
Sergei Golubchik
9cc7eb3226 upate test results after 2300fe2e
that is, after

  commit 2300fe2e0e
  Author: Sergei Golubchik <serg@mariadb.org>
  Date:   Wed May 13 21:57:24 2015 +0200

      Identical key derivation code in XtraDB/InnoDB/Aria
2015-05-16 16:31:46 +02:00
Sergei Golubchik
8815fb3d45 MDEV-8158 InnoDB: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID on dynamic change of encryption variables
don't allow to enable srv_encrypt_tables if no
encryption plugin is loaded
2015-05-15 18:12:02 +02:00
Sergei Golubchik
8258a34800 InnoDB: check if scrubbing is enabled before scanning the tablespace 2015-05-15 18:12:02 +02:00
Sergei Golubchik
a94cabd503 MDEV-8159 InnoDB: Failing assertion: key_state->key_id
to simplify various checks, set crypt_data->key_id even
for not encrypted tablespaces
2015-05-15 18:12:02 +02:00
Sergei Golubchik
2300fe2e0e Identical key derivation code in XtraDB/InnoDB/Aria
* Extract it into the "encryption_scheme" service.
* Make these engines to use the service, remove duplicate code.
* Change MY_AES_xxx error codes, to return them safely
  from encryption_scheme_encrypt/decrypt without conflicting
  with ENCRYPTION_SCHEME_KEY_INVALID error
2015-05-15 18:12:01 +02:00
Nirbhay Choubey
14b816a5c8 Disabling some more sporadically failing galera tests. 2015-05-14 21:48:54 -04:00
Jan Lindström
f8cacd03a7 MDEV-8143: InnoDB: Database page corruption on disk or a failed file read
Analysis: Problem was that we did create crypt data for encrypted table but
this new crypt data was not written to page 0. Instead a default crypt data
was written to page 0 at table creation.

Fixed by explicitly writing new crypt data to page 0 after successfull
table creation.
2015-05-14 11:32:24 +03:00
Sergei Golubchik
16b6ec2e37 MDEV-8130 Wrong error code/message while encrypting a partitioned InnoDB table
when checking for a flag, use & not ==
2015-05-13 14:27:18 +02:00
Sergei Golubchik
acd992d4b7 MDEV-8022 Assertion `rc == 0' failed in ma_encrypt on dropping an encrypted Aria table
fix encryption of the last partial block

* now really encrypt it, using key and iv
* support the case of very short plaintext (less than one block)
* recommend aes_ctr over aes_cbc, because the former
  doesn't have problems with partial blocks
2015-05-13 14:27:17 +02:00
Sergei Golubchik
66380916ee MDEV-7993 file_key_management_filekey doesn't work as expected with FILE:
chomp the secret, as read from the file. remove trailing
CR and LF bytes.
2015-05-13 14:27:16 +02:00
Sergei Golubchik
ab8415d983 move encryption tests to a dedicate suite
remove few tests for variables that never existed (merge error)
2015-05-13 14:27:16 +02:00
Elena Stepanova
0b4231e9f1 MDEV-8154 rpl.show_status_stop_slave_race-7126 sporadically causes internal check failure
The test did not have a proper replication cleanup
2015-05-13 15:17:19 +03:00
Alexander Barkov
8345bc6921 MDEV-8152 is_columns_is_embedded test fails
Recording --ps and --embedded tests (a postfix for MDEV-7807)
2015-05-13 15:34:20 +04:00
Nirbhay Choubey
c9c8e0554f Update galera/disabled.def & some more test fixes. 2015-05-12 23:43:06 -04:00
Elena Stepanova
7003776e73 MDEV-8144 percona.innodb_sys_index test fails
Restoring the line affected by 5.5=>10.0 merge
2015-05-12 19:16:17 -04:00
Nirbhay Choubey
6ae27e4098 Merge branch '5.5-galera' into 10.0-galera 2015-05-12 18:50:59 -04:00
Nirbhay Choubey
c8ad5b2f12 MDEV-8151 : wsrep.foreign_key, wsrep.pool_of_threads,
.. wsrep.binlog_format, wsrep.mdev_6832 fail in buildbot

Galera-3.9 logs an additional warning in the error log if
it fails to find gvwstate.dat file. Update wsrep/suite.pm.
2015-05-12 17:15:16 -04:00
Nirbhay Choubey
c6c9a69cce Fix for some more test failures. 2015-05-12 16:56:06 -04:00
Elena Stepanova
b3d3dd25eb MDEV-8144 percona.innodb_sys_index test fails
Restoring the line affected by 5.5=>10.0 merge
2015-05-12 03:44:10 +03:00
Kristian Nielsen
8bedb638d7 MDEV-8113: Parallel slave: slave hangs on ALTER TABLE (or other DDL) as the first event after slave start
In optimistic parallel replication, it is not safe to try to run a following
transaction in parallel with a DDL statement, and there is code to prevent
this.

However, the code was missing the case where the DDL is the very first event
after slave start. In this case, following transactions could run in
parallel with the DDL, which can cause the slave to hang or even corrupt
slave in unlucky cases.
2015-05-11 12:43:38 +02:00
Ajo Robert
515b2203c5 Bug #18075170 SQL NODE RESTART REQUIRED TO
AVOID DEADLOCK AFTER RESTORE

Analysis
--------
Accessing the restored NDB table in an active multi-statement
transaction was resulting in deadlock found error.

MySQL Server needs to discover metadata of NDB table from
data nodes after table is restored from backup. Metadata
discovery happens on the first access to restored table.
Current code mandates this statement to be the first one
in the transaction. This is because discover needs exclusive
metadata lock on the table. Lock upgrade at this point can
lead to MDL deadlock and the code was written at the time
when MDL deadlock detector was not present. In case when
discovery attempted in the statement other than the first
one in transaction ER_LOCK_DEADLOCK error is reported
pessimistically.

Fix:
---
Removed the constraint as any potential deadlock will be
handled by deadlock detector. Also changed code in discover
to keep metadata locks of active transaction.

Same issue was present in table auto repair scenario. Same
fix is added in repair path also.
2015-05-11 16:05:50 +05:30
Nirbhay Choubey
e11cad9e9d Merge tag 'mariadb-10.0.19' into 10.0-galera 2015-05-09 17:09:21 -04:00
Sergei Golubchik
5fdb14542a MDEV-8021 "InnoDB: Tablespace id 4 encrypted but encryption service not available. Can't continue opening tablespace" on server restart when there are encrypted tables
key id was written in the wrong place on the tablespace first page
(thus its value could not be read back later)
2015-05-09 11:19:36 +02:00
Nirbhay Choubey
99f496ae65 Fix for some failing tests 2015-05-08 17:43:58 -04:00
Nirbhay Choubey
3331d4e07e Merge galera tests from github.com/codership/mysql-wsrep 2015-05-08 17:43:57 -04:00
Philip Stoev
58bbe9b004 Fix suite/galera/t/galera_var_OSU_method.test 2015-05-08 17:41:08 -04:00
Philip Stoev
504ff56ece Adjust tests now that wsrep_OSU_method is a session variable. 2015-05-08 17:41:08 -04:00
Philip Stoev
03a8f83e2c Add tests for galera/mysql-wsrep#90 2015-05-08 17:41:07 -04:00
Teemu Ollakka
f5bce5a600 codership/mysql-wsrep#67 - total order isolation for FLUSH
The following FLUSH commands are now executed under total
order isolation:
* FLUSH DES_KEY_FILE
* FLUSH HOSTS
* FLUSH PRIVILEGES
* FLUSH QUERY CACHE
* FLUSH STATUS
* FLUSH USER_RESOURCES
2015-05-08 17:41:06 -04:00
Alexander Barkov
91ee98a8c8 MDEV-7807 information_schema.processlist truncates queries with binary strings
Adding a new column INFORMATION_SCHEMA.PROCESSLIST.INFO_BINARY.
2015-05-08 00:34:06 +04:00
Sergey Vojtovich
0fcc350f73 MDEV-7922 - ERROR 1939 (HY000): Engine PERFORMANCE_SCHEMA failed to discover
table

Performance schema discovery fails if connection has no active database set.

This happened due to restriction in SQL parser: table name with no database name
is ambiguous in such case.

Fixed by temporary substitution of default database with being discovered table
database.
2015-05-07 20:45:46 +04:00
Jan Lindström
3832bda1ba Fix compiler error if compiler does not support c99 style
initializers.
2015-05-07 18:30:42 +03:00
Jan Lindström
bad81f23f6 MDEV-8046: Server crashes in pfs_mutex_enter_func on select from I_S.INNODB_TABLESPACES_ENCRYPTION if InnoDB is disabled
Problem was that information schema tables innodb_tablespaces_encryption and
innodb_tablespaces_scrubbing where missing required check is InnoDB enabled
or not.
2015-05-06 15:16:28 +03:00
Sergei Golubchik
1d3ea9ecd8 perfschema 5.6.24
including the big commit
  commit 305130361bf72726de220f3d2b2787395e10be61
  Author: Marc Alff <marc.alff@oracle.com>
  Date:   Tue Feb 10 11:31:32 2015 +0100

      WL#8354 BACKPORT DIGEST IMPROVEMENTS TO MYSQL 5.6

(with the following commits) and related changes in sql/
2015-05-05 15:23:47 +02:00
Sergei Golubchik
d71d411905 5.6.24 2015-05-04 22:16:00 +02:00
Sergei Golubchik
49c853fb94 Merge branch '5.5' into 10.0 2015-05-04 22:00:24 +02:00
Nirbhay Choubey
d2562004c5 Merge tag 'mariadb-5.5.43' into 5.5-galera 2015-05-04 13:50:52 -04:00
Sergei Golubchik
f875c9f2a0 MDEV-5114 seconds_behind_master flips to 0 & spikes back, when running show slaves status
1. After a period of wait (where last_master_timestamp=0)
   do NOT restore the last_master_timestamp to the timestamp
   of the last executed event (which would mean we've just
   executed it, and we're that much behind the master).

2. Update last_master_timestamp before executing the event,
   not after.

Take the approach from the this commit (but with a different test
case that actually makes sense):

commit 0c75ab453fb8c5439576af8fe5add7a1b89f1569
Author: Luis Soares <luis.soares@sun.com>
Date:   Thu Apr 15 17:39:31 2010 +0100

    BUG#52166: Seconds_Behind_Master spikes after long idle period
2015-05-03 11:21:55 +02:00
Vicențiu Ciorbaru
6c55e52b10 MDEV-7774: Crash when dropping user within rebuild_role_grants
The issue comes from not taking all possibilities to match an entry
within the roles_mapping HASH, when updating the data structure.
2015-05-03 11:49:49 +03:00
Nirbhay Choubey
320240be1d Merge test for bug#72594 from upstream 2015-04-30 10:23:36 -04:00
Sergei Golubchik
4c87f72773 Merge branch '5.5' into bb-5.5-serg 2015-04-29 16:24:52 +02:00
Kristian Nielsen
9cdf5c2bfd Merge branch '10.0' into 10.1 2015-04-29 11:30:26 +02:00
Kristian Nielsen
9088f26f20 MDEV-7802: group commit status variable addition
Backport into 10.0
2015-04-29 11:29:25 +02:00
Jan Lindström
4c174fcb4a MDEV-8020: innodb.innodb-mdev-7055 produces valgrind warnings in buildbot
Fixed by reverting incorrect fix of MDEC-7055 (reopened) and removing the
test case (because it now crashes).
2015-04-28 15:29:46 +03:00
Kristian Nielsen
ed701c6a23 MDEV-7864: Slave SQL: stopping on non-last RBR event with annotations results in SEGV (signal 11)
The slave SQL thread was clearing serial_rgi->thd before deleting
serial_rgi, which could cause access to NULL THD.

The clearing was introduced in commit
2e100cc5a4 and is just plain wrong. So revert
that part (single line) of that commit.

Thanks to Daniel Black for bug analysis and test case.
2015-04-28 11:56:54 +02:00
Sergei Golubchik
0f12ada6b6 Merge remote-tracking branch 'mysql/5.5' into 5.5 2015-04-27 21:04:06 +02:00
Sergei Golubchik
e26b2071be MDEV-7938 MariaDB Crashes Suddenly while writing binlogs
on disconnect THD must clean user_var_events array before
dropping temporary tables. Otherwise when binlogging a DROP,
it'll access user_var_events, but they were allocated
in the already freed memroot.
2015-04-27 15:42:12 +02:00
V S Murthy Sidagam
7797ef4dec Merge branch 'mysql-5.1' into mysql-5.5 2015-04-27 14:46:40 +05:30
V S Murthy Sidagam
c655515d1b Bug #20683237 BACKPORT 19817663 TO 5.1 and 5.5
Restrict when user table hashes can be viewed. Require SUPER privileges.
2015-04-27 14:33:25 +05:30
Sergei Golubchik
f8320210e7 MDEV-7126 replication slave - deadlock in terminate_slave_thread with stop slave and show variables of replication filters and show global status
Three-way deadlock:

  T1: SHOW GLOBAL STATUS
      -> acquire LOCK_status
  T2: STOP SLAVE
      -> acquire LOCK_active_mi
      -> terminate_slave_thread()
      -> -> cond_timedwait for handle_slave_sql to stop
  T3: sql slave thread (same applies to io thread)
      -> handle_slave_sql(), when exiting
      -> -> THD::add_status_to_global()
      -> -> -> wait for LOCK_status...
  T1: SHOW GLOBAL STATUS
      -> for "Slave_heartbeat_period" status variable
      -> -> show_heartbeat_period()
      -> -> -> wait for LOCK_active_mi

cherry-pick from 5.6:

  commit fc8b395898f40387b3468122bd0dae31e29a6fde
  Author: Venkatesh Duggirala <venkatesh.duggirala@oracle.com>
  Date:   Wed Jun 12 21:41:05 2013 +0530

    BUG#16904035-SHOW STATUS - EXCESSIVE LOCKING ON LOCK_ACTIVE_MI AND
    ACTIVE_MI->RLI->DATA_LOCK

    Problem: Excessive locking on lock_active_mi and rli->data_lock
    while executing any `show status like 'X'` command.

    Analysis: SHOW_FUNCs for Slave_running, Slave_retried_transactions,
    Slave_heartbeat_period, Slave_received_heartbeats,
    Slave_last_heartbeat are acquiring lock_active_mi and rli->data_lock
    to show their variable value. It is ok to show stale data while showing
    the status variables i.e., even if they miss one update, it will
    not cause any great trouble.

    Fix: Remove the locks from the above mentioned SHOW_FUNC functions.

Add a test case
2015-04-26 22:05:33 +02:00
f4rnham
060ec5b6b9 MDEV-7130: MASTER_POS_WAIT(log_name,log_pos,timeout,"connection_name") hangs, does not respect the timeout
Changed also arg_count check for connection_name to prevent same bug
if fifth argument is introduced in future
2015-04-24 13:08:27 +02:00
Kristian Nielsen
c2dd88ac85 Merge MDEV-8031 into 10.1 2015-04-23 14:40:10 +02:00
Kristian Nielsen
b616991a68 MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill)
There was a rare race, where a deadlock error might not be correctly
handled, causing the slave to stop with something like this in the error
log:

150423 14:04:10 [ERROR] Slave SQL: Connection was killed, Gtid 0-1-2, Internal MariaDB error code: 1927
150423 14:04:10 [Warning] Slave: Connection was killed Error_code: 1927
150423 14:04:10 [Warning] Slave: Deadlock found when trying to get lock; try restarting transaction Error_code: 1213
150423 14:04:10 [Warning] Slave: Connection was killed Error_code: 1927
150423 14:04:10 [Warning] Slave: Connection was killed Error_code: 1927
150423 14:04:10 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'master-bin.000001 position 1234

The problem was incorrect error handling. When a deadlock is detected, it
causes a KILL CONNECTION on the offending thread. This error is then later
converted to a deadlock error, and the transaction is retried.

However, the deadlock error was not cleared at the start of the retry, nor
was the lingering kill signal. So it was possible to get another deadlock
kill early during retry. If this happened with particular thread
scheduling/timing, it was possible that the new KILL CONNECTION error was
masked by the earlier deadlock error, so that the second kill was not
properly converted into a deadlock error and retry.

This patch adds code that clears the old error and killed flag before
starting the retry. It also adds code to handle a deadlock kill caught in a
couple of places where it was not handled before.
2015-04-23 14:09:15 +02:00
Nirbhay Choubey
581b49dd3d MDEV-7995 : DMLs not getting replicated with log-bin=OFF & binlog-format != ROW
This bug is a side-effect of fix for MDEV-6924, where we completely
stopped a statement-based event from getting into the binlog cache when
binary logging is not enabled (and thus, wsrep_emulate_binlog mode = 1).
As a result, the SBR events were not replicated.

Fixed by allowing the SBR events to be written into the binlog cache.

Note: Only DMLs were affected as DDLs are replicated via TOI.

Merged galera_create_trigger.test from github.com/codership/mysql-wsrep.
2015-04-22 18:13:30 -04:00
Kristian Nielsen
e7a7ea7ec1 Merge branch '10.0' into 10.1 2015-04-21 10:31:39 +02:00
Kristian Nielsen
4760528754 MDEV-8029: test failure in rpl.rpl_parallel_temptable
Fix a silly typo that caused the test to occasionally fail.
2015-04-21 10:16:14 +02:00
Kristian Nielsen
a15a4d674d Merge MDEV-7802 into 10.1 2015-04-20 13:22:51 +02:00
Kristian Nielsen
791b0ab5db Merge 10.0 -> 10.1 2015-04-20 13:21:58 +02:00
Kristian Nielsen
519ad0f7e3 MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS
This was a regression from the patch for MDEV-7668.

A test was incorrect, so the slave would not properly handle re-using
temporary tables, which lead to replication failure in this case.
2015-04-20 12:59:46 +02:00
Kristian Nielsen
167332597f Merge 10.0 -> 10.1.
Conflicts:
	mysql-test/suite/multi_source/multisource.result
	sql/sql_base.cc
2015-04-17 15:18:44 +02:00
Kristian Nielsen
14d15785d1 MDEV-7802: Omit one test which could fail on very loaded host. 2015-04-17 12:45:55 +02:00
Nirbhay Choubey
0095697784 MDEV-7996 : CURRENT_USER definer does not replicate for triggers
THD's lex->definer initially holds "*current_user" for CURRENT_USER().
As a result when wsrep tries to create the trigger query, it incorrectly
uses "*current_user". Fixed by calling get_current_user() to get the
real current user.

Merged galera_create_trigger.test from github.com/codership/mysql-wsrep.
2015-04-16 16:29:02 -04:00
Alexander Barkov
201c985be5 MDEV-7886 CREATE VIEW IF NOT EXISTS produces a wrong warning 2015-04-13 22:36:49 +04:00
Kristian Nielsen
ed34927065 MDEV-7936: Assertion `!table || table->in_use == _current_thd()' failed on parallel replication in optimistic mode
Additional 10.1-specific test case.
2015-04-13 14:38:25 +02:00
Kristian Nielsen
2de8db6296 Merge MDEV-7936 into 10.1 2015-04-13 14:28:07 +02:00
Kristian Nielsen
17aff4b17b Merge MDEV-7936 into 10.0.
Conflicts:
	sql/sql_base.cc
2015-04-13 14:27:25 +02:00
Kristian Nielsen
60d094aeac MDEV-7936: Assertion `!table || table->in_use == _current_thd()' failed on parallel replication in optimistic mode
Make sure that in parallel replication, we execute wait_for_prior_commit()
before setting table->in_use for a temporary table. Otherwise we can end up
with two parallel replication worker threads competing with each other for
use of a temporary table.

Re-factor the use of find_temporary_table() to be able to handle errors
in the caller (as wait_for_prior_commit() can return error in case of
deadlock kill).
2015-04-13 14:24:18 +02:00
Kristian Nielsen
c47fe0e9db MDEV-7668: Intermediate master groups CREATE TEMPORARY with INSERT, causing parallel replication failure
[This commit cherry-picked to be able to merge MDEV-7936, of which it
is a pre-requisite, into both 10.0 and 10.1.]

Parallel replication depends on locking (table locks, row locks, etc.) to
prevent two conflicting transactions from running and committing in parallel.
But temporary tables are designed to be visible only to one thread, and have
no such locking.

In the concrete issue, an intermediate master could commit a CREATE TEMPORARY
TABLE in the same group commit as in INSERT into that table. Thus, a
lower-level master could attempt to run them in parallel and get an error.

More generally, we need protection from parallel replication trying to run
transactions in parallel that access a common temporary table.

This patch simply causes use of a temporary table from parallel replication
to wait for all previous transactions to commit, serialising the replication
at that point.

(A more fine-grained locking could be added later, possibly. However,
using temporary tables in statement-based replication is in any case
normally undesirable; for example a restart of the server will lose
temporary tables and can break replication).

Note that row-based replication is not affected, as it does not do any
temporary tables on the slave-side.

This patch also cleans up the locking around protecting the list of
temporary tables in Relay_log_info. This used to take the
rli->data_lock at the end of every statement, which is very bad for
concurrency. With this patch, the lock is not taken unless temporary
tables (with statement-based binlogging) are in use on the slave.
2015-04-13 14:08:57 +02:00
Sergei Golubchik
d214c83b5e mtr: make search_pattern_in_file.inc more verbose
report when a pattern is found
do not abort, but merely report when a pattern is not found
2015-04-11 10:22:26 +02:00
Sergei Golubchik
a73676b2e6 Merge branch '10.1' into bb-10.1-serg 2015-04-10 19:32:14 +02:00
Sergei Golubchik
87b46dcdc9 disable scrubbing tests on windows
unportable, use grep
2015-04-10 13:30:12 +02:00
Sergei Golubchik
966b236612 add support for --innodb-encrypt-tables=FORCE
this will prevent user from creating tables with ENCRYPTED=OFF
2015-04-10 02:53:32 +02:00
Sergei Golubchik
da06baa11f mtr: *.opt files, always enable innodb-encrypt-log
because one is supposed always to use it with innodb-encrypt-tables
2015-04-10 02:51:35 +02:00
Sergei Golubchik
bc9f118e29 rename table attribute ENCRYPTION=ON/OFF to ENCRYPTED=YES/NO 2015-04-10 02:51:01 +02:00
Sergei Golubchik
ea764f5f52 s/innodb_default_encryption_key/innodb_default_encryption_key_id/
and make it a session variable, not global, as any decent
default sysvar for a table attribute should be
2015-04-10 02:40:10 +02:00
Sergei Golubchik
92ff523619 change ENCRYPTION_KEY_ID to be HA_TOPTION_SYSVAR
instead of manually implenting "default from a sysvar" in the code
2015-04-10 02:39:36 +02:00
Sergei Golubchik
dd8f931957 be less annoying about sysvar-based table attributes
do not *always* add them to the create table definition,
but only when a sysvar value is different from a default.

also, when adding them - don't quote numbers
2015-04-10 02:36:54 +02:00
Sergei Golubchik
5dffda3ccc Merge branch 'bb-10.1-jan-encryption' into bb-10.1-serg
With changes:

* update tests to pass (new encryption/encryption_key_id syntax).
* not merged the code that makes engine aware of the encryption mode
  (CRYPT_SCHEME_1_CBC, CRYPT_SCHEME_1_CTR, storing it on disk, etc),
  because now the encryption plugin is handling it.
* compression+encryption did not work in either branch before the
  merge - and it does not work after the merge. it might be more
  broken after the merge though - some of that code was not merged.
* page checksumming code was not moved (moving of page checksumming
  from fil_space_encrypt() to fil_space_decrypt was not merged).
* restored deleted lines in buf_page_get_frame(), otherwise
  innodb_scrub test failed.
2015-04-09 19:27:40 +02:00
Sergei Golubchik
3a2ec3fca6 make innodb_encryption_debug test more robust 2015-04-09 18:43:36 +02:00