Commit graph

1257 commits

Author SHA1 Message Date
Jan Lindström
ee768d8e0e MDEV-9640: Add used key_id to INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION 2016-03-18 11:48:49 +02:00
Jan Lindström
f448a800e1 MDEV-9422: Checksum errors on restart when killing busy instance that uses encrypted XtraDB tables
Analysis:

-- InnoDB has n (>0) redo-log files.
-- In the first page of redo-log there is 2 checkpoint records on fixed location (checkpoint is not encrypted)
-- On every checkpoint record there is up to 5 crypt_keys containing the keys used for encryption/decryption
-- On crash recovery we read all checkpoints on every file
-- Recovery starts by reading from the latest checkpoint forward
-- Problem is that latest checkpoint might not always contain the key we need to decrypt all the
   redo-log blocks (see MDEV-9422 for one example)
-- Furthermore, there is no way to identify is the log block corrupted or encrypted

For example checkpoint can contain following keys :

write chk: 4 [ chk key ]: [ 5 1 ] [ 4 1 ] [ 3 1 ] [ 2 1 ] [ 1 1 ]

so over time we could have a checkpoint

write chk: 13 [ chk key ]: [ 14 1 ] [ 13 1 ] [ 12 1 ] [ 11 1 ] [ 10 1 ]

killall -9 mysqld causes crash recovery and on crash recovery we read as
many checkpoints as there is log files, e.g.

read [ chk key ]: [ 13 1 ] [ 12 1 ] [ 11 1 ] [ 10 1 ] [ 9 1 ]
read [ chk key ]: [ 14 1 ] [ 13 1 ] [ 12 1 ] [ 11 1 ] [ 10 1 ] [ 9 1 ]

This is problematic, as we could still scan log blocks e.g. from checkpoint 4 and we do
not know anymore the correct key.

CRYPT INFO: for checkpoint 14 search 4
CRYPT INFO: for checkpoint 13 search 4
CRYPT INFO: for checkpoint 12 search 4
CRYPT INFO: for checkpoint 11 search 4
CRYPT INFO: for checkpoint 10 search 4
CRYPT INFO: for checkpoint 9 search 4 (NOTE: NOT FOUND)

For every checkpoint, code generated a new encrypted key based on key
from encryption plugin and random numbers. Only random numbers are
stored on checkpoint.

Fix: Generate only one key for every log file. If checkpoint contains only
one key, use that key to encrypt/decrypt all log blocks. If checkpoint
contains more than one key (this is case for databases created
using MariaDB server version 10.1.0 - 10.1.12 if log encryption was
used). If looked checkpoint_no is found from keys on checkpoint we use
that key to decrypt the log block. For encryption we use always the
first key. If the looked checkpoint_no is not found from keys on checkpoint
we use the first key.

Modified code also so that if log is not encrypted, we do not generate
any empty keys. If we have a log block and no keys is found from
checkpoint we assume that log block is unencrypted. Log corruption or
missing keys is found by comparing log block checksums. If we have
a keys but current log block checksum is correct we again assume
log block to be unencrypted. This is because current implementation
stores checksum only before encryption and new checksum after
encryption but before disk write is not stored anywhere.
2016-03-18 07:58:04 +02:00
Jan Lindström
d5d0c35f23 Merge pull request #160 from grooverdan/crc32_power_abi_fix
MDEV-9699: power8 crc32: Per the PPC64 ABI, v20-v31 are non-volatile registers
2016-03-15 10:46:33 +02:00
Jan Lindström
a12326458d Add check to avoid NULL-pointer access if encryption information
is not available. Clarify system tablespace page 0 check.
2016-03-13 15:37:47 +02:00
Jan Lindström
f341d94423 MDEV-9549: Trying to decrypt a not encrypted page
Make sure that on decrypt we do not try to reference
NULL pointer and if page contains undefined
FIL_PAGE_FILE_FLUSH_LSN field on when page is not
the first page or page is not in system tablespace,
clear it.
2016-03-12 13:43:33 +02:00
Jan Lindström
8103526b38 MDEV-9667: Server hangs after select count(distinct name) from t2 where a=8366 and b>=5 and b<=5;
In row_search_for_mysql function on XtraDB there was a old logic
where null bytes were inited. This caused server to think that
key value is null and continue on incorrect path.
2016-03-11 13:36:29 +02:00
Anton Blanchard
5ea894a7c8 MDEV-9699: power crc32: Per the PPC64 ABI, v20-v31 are non-volatile registers
These where modified and not restored.

Corrected as per upstream:

f2145e5858...aaf0ac4
2016-03-08 16:17:32 +11:00
Otto Kekäläinen
1777fd5f55 Fix spelling: occurred, execute, which etc 2016-03-04 02:09:37 +02:00
Nirbhay Choubey
0251232f8c Fix to ensure updates in gtid_slave_state table do not get binlogged.
Also, renamed wsrep_skip_append_keys to wsrep_ignore_table.
Test case : galera.galera_as_slave_gtid.test
2016-02-24 23:32:37 -05:00
Nirbhay Choubey
cceec7858f Merge branch '10.0-galera' into bb-10.1-serg 2016-02-24 01:21:40 -05:00
Nirbhay Choubey
0d58323e26 Merge tag 'mariadb-10.0.24' into 10.0-galera 2016-02-23 20:53:29 -05:00
Sergei Golubchik
a5679af1b1 Merge branch '10.0' into 10.1 2016-02-23 21:35:05 +01:00
Nirbhay Choubey
2cdcde93c5 Merge sync point from previous commit to XtraDB. 2016-02-23 00:19:41 -05:00
Nirbhay Choubey
c1ea0570af refs codership/mysql-wsrep#184
Merge fix to XtraDB engine.
2016-02-22 16:51:45 -05:00
Nirbhay Choubey
2c56142b77 refs codership/mysql-wsrep#184
Merge fix to XtraDB engine.
2016-02-22 16:36:05 -05:00
Sergei Golubchik
a4b2714968 Merge branch 'bb-10.0-serg' into 10.0 2016-02-17 21:42:57 +01:00
Jan Lindström
36ca65b73b MDEV-9559: Server without encryption configs crashes if selecting from an implicitly encrypted table
There was two problems. Firstly, if page in ibuf is encrypted but
decrypt failed we should not allow InnoDB to start because
this means that system tablespace is encrypted and not usable.
Secondly, if page decrypt is detected we should return false
from buf_page_decrypt_after_read.
2016-02-17 12:32:07 +02:00
Sergei Golubchik
17a792a441 Merge branch 'merge-xtradb-5.6' into 10.0 2016-02-16 18:55:00 +01:00
Sergei Golubchik
d520d35380 Revert "MDEV-8696: Adding indexes on empty table is slow with large innodb_sort_buffer_size."
This reverts commit 13884cf206.

Fixed in 5.6 (merged in the next commit)
2016-02-16 12:53:24 +01:00
Sergei Golubchik
d76eba6a6b 5.6.28-76.1 2016-02-16 12:06:16 +01:00
Jan Lindström
a70b8961f4 MDEV-9424: Server crashes when slave works with partitioned tables copied from Windows to Linux
Add check to avoid NULL-pointer access and added warning if share->ib_table
is not what expected.
2016-02-15 18:38:15 +02:00
Jan Lindström
c0b6c27dbe MDEV-9548: Alter table (renaming and adding index) fails with "Incorrect key file for table"
MDEV-9469: 'Incorrect key file' on ALTER TABLE

InnoDB needs to rebuild table if column name is changed and
added index (or foreign key) is created based on this new
name in same alter table.
2016-02-15 14:48:15 +02:00
Sergei Golubchik
1fc6e297f2 XtraDB/InnoDB crash with autoinc, vcol and online alter
Fix the doubly questional fix for MySQL Bug#17250787:
* it detected autoinc index by looking for the first index
  that starts from autoinc column. never mind one column
  can be part of many indexes.
* it used autoinc_field->field_index to look up into internal
  innodb dictionary. But field_index accounts for virtual
  columns too, while innodb dictionary ignores them.

Find the index by its name, like elsewhere in ha_innobase.
2016-02-15 13:02:21 +01:00
Sergei Golubchik
afce5415de Merge branch 'merge-xtradb-5.5' into 5.5
5.5.47-37.7
2016-02-09 14:06:45 +01:00
Sergei Golubchik
3cfd36bbe2 5.5.47-37.7 2016-02-09 00:13:25 +01:00
Jan Lindström
33ac501b6a Use C++ linkage. 2016-02-04 13:54:57 +02:00
Jan Lindström
1d00d5c626 Fix function visibility as it is used on row0mysql.c in Windows. 2016-02-03 16:51:23 +02:00
Jan Lindström
a3d843d949 Fix function visibility as it is used on row0mysql.c in Windows. 2016-02-03 15:52:26 +02:00
Jan Lindström
73d23f8581 MDEV-9471: Server crashes or returns an error while trying to alter partitioning on a table moved from Windows to Linux
At alter table when server renames the table to temporal name,
old name uses normal partioned table naming rules. However,
if tables are created on Windows and then transfered to Linux
and lower-case-table-names=1 we should modify the old name
on rename to lower case to be able to find it from the
InnoDB dictionary.
2016-02-03 14:34:06 +02:00
Jan Lindström
f66d01610f MDEV-9471: Server crashes or returns an error while trying to alter partitioning on a table moved from Windows to Linux
At alter table when server renames the table to temporal name,
old name uses normal partioned table naming rules. However,
if tables are created on Windows and then transfered to Linux
and lower-case-table-names=1 we should modify the old name
on rename to lower case to be able to find it from the
InnoDB dictionary.
2016-02-03 12:22:31 +02:00
Sergei Golubchik
02cc921a44 compiler warnings 2016-01-27 16:40:15 +01:00
Vladislav Vaintroub
c76ab94fa9 Fix invalid format warnings 2016-01-26 14:36:13 +01:00
Jan Lindström
111acb721f MDEV-9359: encryption.create_or_replace fails sporadically in buildbot: failing assertion: mutex->magic_n == MUTEX_MAGIC_N
Make sure that encryption threads mutex is initialized before starting
encryption threads.
2016-01-05 18:50:54 +02:00
Sergey Vojtovich
93b078cc85 MDEV-9128 - Compiling on IBM System Z fails
Provided IBM System Z have outdated compiler version, which supports gcc sync
builtins but not gcc atomic builtins. It also has weak memory model.

InnoDB attempted to verify if __sync_lock_test_and_set() is available by
checking IB_STRONG_MEMORY_MODEL. This macro has nothing to do with availability
of __sync_lock_test_and_set(), the right one is HAVE_ATOMIC_BUILTINS.
2015-12-29 14:24:46 +04:00
Sergey Vojtovich
30b2447f7d MDEV-9128 - Compiling on IBM System Z fails
Provided IBM System Z have outdated compiler version, which supports gcc sync
builtins but not gcc atomic builtins. It also has weak memory model.

InnoDB attempted to verify if __sync_lock_test_and_set() is available by
checking IB_STRONG_MEMORY_MODEL. This macro has nothing to do with availability
of __sync_lock_test_and_set(), the right one is HAVE_ATOMIC_BUILTINS.
2015-12-27 15:40:34 +04:00
Sergei Golubchik
7697bf0bd7 Merge branch 'github/10.0-galera' into 10.1
Note: some tests fail, just as they failed before the merge!
2015-12-22 10:32:33 +01:00
Sergei Golubchik
dfb58a3782 innodb/xtradb: init scrub mutex even in read-only mode
because it's locked for innodb part of SHOW STATUS,
which can happen in read-only mode too.
2015-12-21 21:25:01 +01:00
Sergei Golubchik
a2bcee626d Merge branch '10.0' into 10.1 2015-12-21 21:24:22 +01:00
Jan Lindström
080da551ea MDEV-8869: Potential lock_sys->mutex deadlock
In wsrep BF we have already took lock_sys and trx
mutex either on wsrep_abort_transaction() or
before wsrep_kill_victim(). In replication we
could own lock_sys mutex taken in
lock_deadlock_check_and_resolve().
2015-12-21 16:36:26 +02:00
Nirbhay Choubey
dad555a09c Merge tag 'mariadb-10.0.23' into 10.0-galera 2015-12-19 14:24:38 -05:00
Jan Lindström
428e09a789 Fix buildbot failure seen on p8-rhel71.
Currently we support file block sizes 512K-4K.
2015-12-18 11:22:58 +02:00
Jan Lindström
206039b8ba Merge pull request #135 from grooverdan/crc32_conditional
Do not build optimised power crc32 on bigendian
2015-12-18 10:11:02 +02:00
Daniel Black
e4e2d9dd3c Do not build optimised power crc32 on bigendian 2015-12-18 17:15:06 +11:00
Jan Lindström
69147040a6 MDEV-9236: Dramatically overallocation of InnoDB buffer pool leads to crash
Part I: Add diagnostics to page allocation if state is not correct
but do not assert if it is incorrect.
2015-12-17 19:45:42 +02:00
Jan Lindström
670bc0b352 Improve validation. If page type is not valid, try to print more
information from the page (note that page could be corrupt).
2015-12-17 09:24:54 +02:00
Jan Lindström
953d5680a3 Merge pull request #133 from grooverdan/power-crc32
MDEV-9288: Use POWER8 accelerated crc32
2015-12-16 09:34:24 +02:00
Daniel Black
60f09cd2b7 MDEV-9288: portablity for compling on non-power platforms
Also removed surperflous stdio include.
2015-12-16 11:12:05 +11:00
Jan Lindström
1ac6640210 MDEV-9129: Server is restarting in the loop after crash
Analysis: We have reserved ROW_MERGE_RESERVE_SIZE ( = 4) for
encryption key_version. When calculating is there more
space on sort buffer, this value needs to be substracted
from current available space.
2015-12-15 20:37:33 +02:00
Jan Lindström
98c9fbfa21 MDEV-8297: information_schema.innodb_sys_tablestats.modified_counter doesn't change on UPDATE
Update modified-counter also if update effects non-indexed columns.
2015-12-15 11:29:15 +02:00
Alexander Barkov
e9b4a041af MDEV-8721 AIX: Compile error xtradb:log0log.cc 2015-12-15 11:59:37 +04:00
Jan Lindström
b63bf7368b MDEV-8923: port innodb_buffer_pool_dump_pct from MySQL
Backport pull request #125 from grooverdan/MDEV-8923_innodb_buffer_pool_dump_pct to 10.0

WL#6504 InnoDB buffer pool dump/load enchantments

This patch consists of two parts:

    1. Dump only the hottest N% of the buffer pool(s)
    2. Prevent hogging the server duing BP load

From MySQL - commit b409342c43ce2edb68807100a77001367c7e6b8e

Add testcases for innodb_buffer_pool_dump_pct_basic.

Part of the code authored by Daniel Black
2015-12-15 09:35:22 +02:00
Daniel Axtens
2538c7cf89 Use POWER8 accelerated crc32
- Make accelerated checksum available to InnoDB and XtraDB.
 - Fall back to slice-by-eight if not available. The mode used is printed on startup.
 - Will only build on POWER systems at the moment until CMakeLists are modified
   to only add the crc32_power8/ files when building on POWER.

running MySQL-5.7 unittest/gunit/innodb/ut0crc32-t

Before:

1..2
Using software crc32 implementation, CPU is little-endian
ok 1
Using software crc32 implementation, CPU is little-endian
    normal CRC32: real    0.148006 sec
    normal CRC32: user    0.148000 sec
    normal CRC32: sys     0.000000 sec
big endian CRC32: real    0.144293 sec
big endian CRC32: user    0.144000 sec
big endian CRC32: sys     0.000000 sec
ok 2

After:

1..2
Using POWER8 crc32 implementation, CPU is little-endian
ok 1
Using POWER8 crc32 implementation, CPU is little-endian
    normal CRC32: real    0.008097 sec
    normal CRC32: user    0.008000 sec
    normal CRC32: sys     0.000000 sec
big endian CRC32: real    0.147043 sec
big endian CRC32: user    0.144000 sec
big endian CRC32: sys     0.000000 sec
ok 2

Author CRC32 ASM code: Anton Blanchard <anton@au.ibm.com>
ref: https://github.com/antonblanchard/crc32-vpmsum

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2015-12-15 15:11:17 +11:00
Jan Lindström
99404c3437 MDEV-9276: MySQL Bug #78754: FK definitions missing from SHOW CREATE TABLE in "innodb_read_only" mode 2015-12-14 22:10:37 +02:00
Nirbhay Choubey
18173ddfc4 MDEV-9162 : MariaDB Galera Cluster memory leak on async slave node
As galera node (slave) received query log events from an async
replication master, it partially wrote the updates made to replication
state table (mysql.gtid_slave_pos) to galera transaction writeset post
TOI. As a result, the transaction handle, thus created within galera,
was never freed/purged as the corresponding trx did not commit.
Thus, it kept piling up for every query log event and was only reclaimed
upon server shutdown when the transaction map object got destructed.
Fixed by making sure that updates in replication slave state table
are not written to galera transaction writeset and thus, not replicated
to other nodes.
2015-12-14 11:33:52 -05:00
Vladislav Vaintroub
0db50be893 Fix logic around retrying failed Windows async IO as synchronous IO . os_file_write/read macros were wrong (had wrong number of args), among other things 2015-12-14 17:06:08 +01:00
Vladislav Vaintroub
f0da062818 fix compile error on Windows 2015-12-14 17:02:42 +01:00
Jan Lindström
4437f51682 MDEV-8869: Potential lock_sys->mutex deadlock
In wsrep brute force (BF) we have already took lock_sys and trx
mutex either on wsrep_abort_transaction() or
before wsrep_kill_victim().
2015-12-14 10:10:09 +02:00
Sergei Golubchik
359ae59ac0 Merge branch 'merge/merge-xtradb-5.6' into 10.0 2015-12-13 16:23:02 +01:00
Sergei Golubchik
1e270d504d 5.6.27-76.0 2015-12-13 10:13:18 +01:00
Sergei Golubchik
1623995158 Merge branch '5.5' into 10.0 2015-12-13 00:10:40 +01:00
Jan Lindström
c19972fc87 MDEV-9251: Fix MySQL Bug#20755615: InnoDB compares column names case sensitively,
while according to Storage Engine API column names should be compared
case insensitively. This can cause FRM and InnoDB data dictionary to
go out of sync.
2015-12-11 14:33:41 +02:00
Jan Lindström
311f0308d0 MDEV-9148: Assertion `thd->stmt_arena != thd->progress.arena' failed in thd_progress_init
Called thd_progress_init() from several threads used for FT-index
creation. For FT-indexes, need better way to report progress,
remove current one for them.
2015-12-10 16:53:19 +02:00
Sergey Vojtovich
b07043fd51 MDEV-8178 - Wrong progress report for operations on InnoDB tables
Correct InnoDB calls to progress report API:
- second argument of thd_progress_init() is number of stages, one stage is
  enough for the row merge
- third argument of thd_progress_report() is some value indicating threshold,
  for the row merge it is file->offset
- second argument of thd_progress_report() is some value indicating current
  state, for the row merge it is file->offset - num_runs.
2015-12-10 13:46:01 +04:00
Sergei Golubchik
d67aacb4fb fix xtradb compilation on windows 2015-12-09 17:11:55 +01:00
Sergei Golubchik
142b725607 Merge branch 'merge/merge-xtradb-5.5' into 5.5
5.5.46-37.6
2015-12-09 12:57:04 +01:00
Sergei Golubchik
9457139e59 5.5.46-37.6 2015-12-09 12:27:04 +01:00
Sergei Golubchik
ef47b62551 MDEV-8827 Duplicate key with auto increment
fix innodb auto-increment handling
three bugs:
1. innobase_next_autoinc treated the case of current<offset incorrectly
2. ha_innobase::get_auto_increment didn't recalculate current when increment changed
3. ha_innobase::get_auto_increment didn't pass offset down to innobase_next_autoinc
2015-12-07 15:20:23 +01:00
Jan Lindström
e528fe79b8 Fix gcc v5.compiler errors. 2015-12-05 12:21:33 +02:00
Jan Lindström
082b859d0d MDEV-9233: Copying MySQL 5.5 data directory to 10.0 with partition tables crashes on insert
Analysis: There were two problems. (1) if partition table was
created using lower_case_tables = 1 on windows we did find the
correct table but we did not set share->ib_table correctly.
(2) we did open table on dictionary but did not increase
mysql_open_tables.

Fix: In xtradb allow access to tables with incorrect
lower case names (warning is printed to error log). If
table is opened increase mysql_open_tables count to avoid
crash on flush tables.
2015-12-04 14:24:03 +02:00
Jan Lindström
33589b25ef MDEV-7762 InnoDB: Failing assertion: block->page.buf_fix_count > 0 in buf0buf.ic line 730
Analysis: debug only assertion I_S function (IS is XtraDB feature) is calling
buf_block_get_frame on any page it reads, which debug-asserts that the page is
buffer-fixed, which is not the case in I_S query.

Fixed by holding the buffer page mutex while the fields are read directly.
2015-12-03 13:18:10 +02:00
Vasil Dimov
a816df7009 MDEV-8923 Port innodb_buffer_pool_dump_pct
WL#6504 InnoDB buffer pool dump/load enchantments

This patch consists of two parts:

1. Dump only the hottest N% of the buffer pool(s)
2. Prevent hogging the server duing BP load

From MySQL - commit b409342c43ce2edb68807100a77001367c7e6b8e
2015-11-29 18:08:42 +11:00
Monty
f813a00029 Fixed failing test cases and compiler warnings found by buildbot
- Added some extra command to rpl_start_stop to ensure that the
  IO thread has connected to the master before we shut down the server.
- if signal returns signalhandler_t, use this with the alarm code
- Added missing tests to sys_vars
- Fixed some possible overflow bugs in tabxml.cpp
2015-11-24 20:04:12 +02:00
Sergei Golubchik
e3d37bfebf Merge branch 'connect/10.1' into 10.1 2015-11-19 18:09:06 +01:00
Sergei Golubchik
7f19330c59 Merge branch 'github/10.0-galera' into 10.1 2015-11-19 17:48:36 +01:00
Sergei Golubchik
beded7d9c9 Merge branch '10.0' into 10.1 2015-11-19 15:52:14 +01:00
Sergei Golubchik
ab476a8d10 Merge branch '5.5' into 10.0 2015-11-18 22:03:02 +01:00
Jan Lindström
5d754fce95 MDEV-8854: New warning messages are unreadable
Improved warning messages by quote marks.
2015-11-09 09:24:52 +02:00
Jan Lindström
25f8738112 MDEV-9040: 10.1.8 fails after upgrade from 10.0.21
Analysis: Lengths which are not UNIV_SQL_NULL, but bigger than the following
number indicate that a field contains a reference to an externally
stored part of the field in the tablespace. The length field then
contains the sum of the following flag and the locally stored len.

This was incorrectly set to

define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE_MAX)

When it should be

define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE_DEF)

Additionally, we need to disable support for > 16K page size for
row compressed tables because a compressed page directory entry
reserves 14 bits for the start offset and 2 bits for flags.
This limits the uncompressed page size to 16k. To support
larger pages page directory entry needs to be larger.
2015-11-05 10:30:48 +02:00
Nirbhay Choubey
2399f1aee7 Fix for build failure. 2015-11-04 21:56:46 -05:00
Nirbhay Choubey
4d15112962 Merge tag 'mariadb-10.0.22' into 10.0-galera 2015-10-31 18:07:02 -04:00
Jan Lindström
81d35841bd MDEV-9011: Redo log encryption does not work
Redo log encryption used too short buffer when getting
encryption keys.
2015-10-30 13:12:30 +02:00
Jan Lindström
3e98383787 Fix test failures seen on buildbot. 2015-10-30 08:39:05 +02:00
Jan Lindström
0fe5eb5cae MDEV-9032: MariaDB 10.1.8 crashes at startup
Add diagnostics when externally stored field is freed but
rollback ctx is not what we expect.
2015-10-29 08:21:28 +02:00
Jan Lindström
f2ab9abbd6 MDEV-9000: storage/xtradb/fil/fil0pagecompress.cc fails to compile on i686-linux
Incorrect parameter type was used. Fixed by casting data types to correct
ones.
2015-10-28 09:14:22 +02:00
Jan Lindström
4834d822ef MDEV-8932: innodb buffer pool hit rate is less than zero
In buffer pool read hit rate calculation can lead rate that is
less than zero.
2015-10-28 08:42:51 +02:00
Sergei Golubchik
a9b5a8d505 Merge branch 'bb-10.0-serg' into 10.0 2015-10-28 00:08:18 +01:00
Jan Lindström
13884cf206 MDEV-8696: Adding indexes on empty table is slow with large innodb_sort_buffer_size.
Analysis: Current implementation will write and read at least one block
(sort_buffer_size bytes) from disk / index even if that block does not
contain any records.

Fix: Avoid writing / reading empty blocks to temporary files (disk).
2015-10-27 13:00:15 +02:00
Sergei Golubchik
84da1547e6 MDEV-8883 more cross-compiling fixes
use CHECK_C_SOURCE_COMPILES for atomic tests if cross-compiling
(continue to use CHECK_C_SOURCE_RUNS otherwise)
2015-10-24 19:58:34 +02:00
Sergei Golubchik
df8832caae MDEV-8883 more cross-compiling fixes
don't abort with "XtraDB not supported" if XtraDB was disabled
in this build.
2015-10-22 15:23:18 +02:00
Jan Lindström
17b0b45b1d Code cleanup. 2015-10-21 09:20:54 +03:00
Jan Lindström
f3e362464b MDEV-8869: Potential lock_sys->mutex deadlock
Analysis: We are alreading holing lock_sys mutex when we call thd::awake.
This could lead mutex deadlock if trx->current_lock_mutex_owner is not
correctly set.

Fix: Make sure that trx->current_lock_mutex_owner is correctly set.
2015-10-20 13:41:14 +03:00
Sergey Vojtovich
6346d1de2f MDEV-427/MDEV-5713 Add systemd script with notify functionality
After review/QA fixes.
2015-10-12 17:51:49 +02:00
Daniel Black
20c2ae39db MDEV-427/MDEV-5713 Add systemd script with notify functionality 2015-10-12 17:51:49 +02:00
Sergei Golubchik
dfb74dea30 Merge branch '10.0' into 10.1 2015-10-12 00:37:58 +02:00
Sergei Golubchik
e7cb032e56 fixes for buildbot:
* update *.result files
* fix XtraDB for Windows (again)
2015-10-10 11:07:29 +02:00
Sergei Golubchik
01be663c50 Merge branch 'merge-xtradb-5.6' into 10.0 2015-10-09 18:16:27 +02:00
Sergei Golubchik
6a821d78a6 5.6.26-74.0 2015-10-09 17:20:49 +02:00
Sergei Golubchik
16c4b3c68b fixes for buildbot:
* OSX (mysqlimport freeing unallocated memory)
* Windows (didn't compile MSI)
* fulltest2 (innodb crashes in --embedded --big)
2015-10-09 16:43:59 +02:00
Sergei Golubchik
f41a41fd91 Merge branch 'merge-xtradb-5.5' into 5.5 2015-10-09 00:06:16 +02:00
Sergei Golubchik
db79f4cf61 5.5.45-37.4 2015-10-08 23:02:43 +02:00
Jan Lindström
21adad000a MDEV-8901: InnoDB: Punch hole is incorrecty done also to log files causing assertion and database corruption
Analysis: Problem is that punch hole does not know the actual page size
of the page and does the page belong to an data file or to a log file.

Fix: Pass down the file type and page size to os layer to be used
when trim is called. Also fix unsafe null pointer access to
actual write_size.
2015-10-06 15:40:26 +03:00
Jan Lindström
5e7f100bf5 MDEV-8523: InnoDB: Assertion failure in file buf0buf.cc line 5963 (Failing assertion: key_version == 0 || key_version >= bpage->key_version) 2015-10-02 09:45:02 +03:00
Sergey Vojtovich
bb22eb55db MDEV-8379 - SUSE mariadb patches
Corrected variable name in dead code for consistency.

Patch contributed by Michal Hrusecky.
2015-10-01 13:40:23 +04:00
Jan Lindström
3266216f2c MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key
Analysis: When a page is read from encrypted table and page can't be
decrypted because of bad key (or incorrect encryption algorithm or
method) page was incorrectly left on buffer pool.

Fix: Remove page from buffer pool and from pending IO.
2015-10-01 08:20:27 +03:00
Jan Lindström
c13f4091f5 MDEV-8815: InnoDB should refuse to start if crash recovery fails instead of asserting
Added error handling to crash recovery so that we stop instead of
asserting.
2015-09-29 15:15:28 +03:00
Jan Lindström
a95711e45d MDEV-8855: innodb.innodb-fk-warnings fails on Windows
Fixed incorrect access to freed memory.
2015-09-29 08:39:54 +03:00
Jan Lindström
c5922c5701 MDEV-8821: Failing assertion: !page || page_type != 0 in file log0recv. cc line 1404
Alloc creating crypt_data to empty page at crash recovery and redo.
2015-09-28 14:03:23 +03:00
Jan Lindström
26e4403f64 MDEV-8819: Failing assertion: block->page.space == page_get_space_id(page_align(ptr)) in file buf0buf.cc line 2551
Add error handling on page reading and do not try to access empty pages.
2015-09-25 11:54:03 +03:00
Jan Lindström
5c62dd21e8 MDEV-8832: Encryption meta data should not be stored when ENCRYPTED=DEFAULT and innodb-encrypt-tables=OFF 2015-09-23 17:34:36 +03:00
Jan Lindström
180c44e0f6 MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
Folloup: Made encryption rules too strict (and incorrect). Allow creating
table with ENCRYPTED=OFF with all values of ENCRYPTION_KEY_ID but create
warning that nondefault values are ignored. Allow creating table with
ENCRYPTED=DEFAULT if used key_id is found from key file (there was
bug on this) and give error if key_id is not found.
2015-09-23 10:20:05 +03:00
Jan Lindström
0cf39f401c MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
Analysis: Problem sees to be the fact that we allow creating or altering
table to use encryption_key_id that does not exists in case where
original table is not encrypted currently. Secondly we should not
do key rotation to tables that are not encrypted or tablespaces
that can't be found from tablespace cache.

Fix: Do not allow creating unencrypted table with nondefault encryption key
and do not rotate tablespaces that are not encrypted (FIL_SPACE_ENCRYPTION_OFF)
or can't be found from tablespace cache.
2015-09-22 15:13:48 +03:00
Jan Lindström
89af0f11a8 MDEV-8770: Incorrect error message when importing page compressed tablespace
Added decompression and after page update recompression support for
import.
2015-09-22 07:35:00 +03:00
Jan Lindström
161db7c18f MDEV-8773: InnoDB innochecksum does not work with encrypted or page compressed tables 2015-09-19 11:31:39 +03:00
Olivier Bertrand
9c6405fefa Commit resolved conflicts 2015-09-18 18:39:08 +02:00
Jan Lindström
9e6f3df51a MDEV-8799: Server crashes in btr_defragment_add_index, encryption.innodb-bad-key-change5 and alike fail in buildbot
Problem was unsafe access to NULL pointer. Added additional checks to avoid
access to NULL pointer.
2015-09-15 09:40:04 +03:00
Jan Lindström
3079bd43af Fix release build compile failure. 2015-09-14 16:28:16 +03:00
Jan Lindström
4d3f680c95 MDEV-8772: Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys
Add error handling to decryp function when decrypt fails during
import.
2015-09-14 14:11:23 +03:00
Jan Lindström
ddaddf1019 MDEV-8769: Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys
Add error handling when getting block from encrypted table and decryption
fails.
2015-09-14 12:15:27 +03:00
Jan Lindström
71b1444601 MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
Add error handling to btr_validate_index when index root block
can't be read because block decryption fails.
2015-09-14 11:01:14 +03:00
Jan Lindström
d581ef5b2c MDEV-8764: Wrong error when encrypted table can't be decrypted.
Add a new error message when table is encrypted but decryption
fails. Use this new error message on InnoDB/XtraDB.
2015-09-14 08:27:36 +03:00
Elena Stepanova
80089a60e5 Follow-up for MDEV-8675 and MDEV-8676
type_spatial_indexes test is now be re-enabled, and the new result file
can be used for creating engine-specific rdiffs
2015-09-14 03:12:54 +03:00
Jan Lindström
067ed23c27 MDEV-8774: Test innodb.innodb_bug53290 failures on buildbot
Problem was -O2 and __attribute__((nonnull)) when it should have been
__attribute__((nonnull(1,2,3,4,5)))
2015-09-08 21:04:46 +03:00
Jan Lindström
2c1553e545 MDEV-8774: Test innodb.innodb_bug53290 failures on buildbot
Fixed unsafe reference to null pointer.
2015-09-08 16:23:19 +03:00
Jan Lindström
509b836623 MDEV-8708: InnoDB temp file encryption
Added encryption support for online alter table where InnoDB temporary
files are used. Added similar support also for tables containing
full text-indexes.

Made sure that table remains encrypted during discard and import
tablespace.
2015-09-08 08:38:12 +03:00
Jan Lindström
5448e0a6dc MDEV-8745: Bad InnoDB logging: "[Note] InnoDB: not started" 2015-09-07 08:34:04 +03:00
Jan Lindström
a0df8225ec MDEV-8753: 10.1 build is broken: xtradb/handler/ha_innodb.cc:21430: error: redefinition of 'void ib_push_warning(trx_t*, ulint, const char*, ...)'
Fixed bad merge.
2015-09-05 07:18:57 +03:00
Jan Lindström
e04723d754 MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key
Analysis: Server tried to continue reading tablespace using a cursor after
we had resolved that pages in the tablespace can't be decrypted.

Fixed by addind check is tablespace still encrypted.
2015-09-04 20:19:45 +03:00
Jan Lindström
7e916bb86f MDEV-8588: Assertion failure in file ha_innodb.cc line 21140 if at least one encrypted table exists and encryption service is not available
Analysis: Problem was that in fil_read_first_page we do find that
    table has encryption information and that encryption service
    or used key_id is not available. But, then we just printed
    fatal error message that causes above assertion.

    Fix: When we open single table tablespace if it has encryption
    information (crypt_data) store this crypt data to the table
    structure. When we open a table and we find out that tablespace
    is not available, check has table a encryption information
    and from there is encryption service or used key_id is not available.
    If it is, add additional warning for SQL-layer.
2015-09-04 20:19:45 +03:00
Jan Lindström
e1978234eb MDEV-8588: Assertion failure in file ha_innodb.cc line 21140 if at least one encrypted table exists and encryption service is not available
Analysis: Problem was that in fil_read_first_page we do find that
table has encryption information and that encryption service
or used key_id is not available. But, then we just printed
fatal error message that causes above assertion.

Fix: When we open single table tablespace if it has encryption
information (crypt_data) store this crypt data to the table
structure. When we open a table and we find out that tablespace
is not available, check has table a encryption information
and from there is encryption service or used key_id is not available.
If it is, add additional warning for SQL-layer.
2015-09-04 20:19:33 +03:00
Sergei Golubchik
66b9a9409c New encryption API. Piece-wise encryption.
Instead of encrypt(src, dst, key, iv) that encrypts all
data in one go, now we have encrypt_init(key,iv),
encrypt_update(src,dst), and encrypt_finish(dst).

This also causes collateral changes in the internal my_crypt.cc
encryption functions and in the encryption service.

There are wrappers to provide the old all-at-once encryption
functionality. But binlog events are often written piecewise,
they'll need the new api.
2015-09-04 10:33:50 +02:00
Sergei Golubchik
e74f91dfd7 cmake: always use the same function to test for compiler flags
Fix all cmake tests (including plugin) to use
MY_CHECK_AND_SET_COMPILER_FLAG. And fix that function
to be compatible with cmake 3.0. This way flag checks
are correctly cached (even in cmake 3.0) and properly reused.
2015-09-04 10:32:02 +02:00
Sergei Golubchik
a5b0a32ac3 Merge branch '10.0-galera' into 10.1 2015-09-03 16:32:00 +02:00
Sergei Golubchik
530a6e7481 Merge branch '10.0' into 10.1
referenced_by_foreign_key2(), needed for InnoDB to compile,
was taken from 10.0-galera
2015-09-03 12:58:41 +02:00
Eric Herman
f66ef6a05d Add lru evict count for the idle loop (xtradb) 2015-08-26 11:50:47 +02:00
Eric Herman
df32920ba0 Add eviction count for table cache lru cleanup (xtradb) 2015-08-26 10:27:19 +02:00
Nirbhay Choubey
f533b2b462 Merge branch '5.5-galera' into 10.0-galera 2015-08-25 11:15:45 -04:00
Nirbhay Choubey
4ee28865f6 MDEV-5146 : Bulk loads into partitioned table not working
When wsrep is enabled, for any update on innodb tables, the
corresponding keys are appended to galera's transaction writeset
(wsrep_append_keys()). However, for LOAD DATA, this got skipped
if binary logging was disabled or it was non-ROW based.
As a result, while the updates from LOAD DATA on non-partitioned
tables replicated fine as wsrep implicitly enables binary logging
(if not enabled, explicitly), the same did not work on partitioned
tables as for partitioned tables the binary logging gets disabled
temporarily (ha_partition::write_row()).

Fixed by removing the unwanted conditions from the check.
Also backported some changes from 10.0-galera to make sure
wsrep_load_data_splitting affects LOAD DATA commands only.
2015-08-20 20:55:52 -04:00
Monty
4374da63f0 Merge /my/maria-10.1-default into 10.1 2015-08-18 11:27:00 +03:00
Monty
dfac82e44d Fixed failing tests and compiler warnings
- UNINIT_VAR() was required for 4.8.3 on openSUSE 13.2
2015-08-18 11:18:58 +03:00
Jan Lindström
bfb6ea0232 MDEV-8589: Non-default ENCRYPTION_KEY_ID is ignored upon reading a table
Analysis: Problem was that when a new tablespace is created a default
encryption info is also created and stored to the tablespace. Later a
new encryption information was created with correct key_id but that
does not affect on IV.

Fix: Push encryption mode and key_id to lower levels and create
correct encryption info when a new tablespace is created.

This fix does not contain test case because, currently incorrect
encryption key causes page corruption and a lot of error messages
to error log causing mtr to fail.
2015-08-14 16:25:18 +03:00
Jan Lindström
a80753594a MDEV-8591: Database page corruption on disk or a failed space, Assertion failure in file buf0buf.cc line 2856 on querying a table using wrong default encryption key
Improved error messaging to show based on original page before
encryption is page maybe encrypted or just corrupted.
2015-08-14 15:49:56 +03:00
Nirbhay Choubey
91acc8b16f Merge tag 'mariadb-10.0.21' into 10.0-galera 2015-08-08 14:21:22 -04:00
Jan Lindström
46ad86f6a3 MDEV-8582: innodb_force_primary_key option does not force PK or unique key
Analysis: Handler used table flag HA_REQUIRE_PRIMARY_KEY but a bug on
sql_table.cc function mysql_prepare_create_table internally marked
secondary key with NOT NULL colums as unique key and did not then
fail on requirement that table should have primary key or unique key.
2015-08-08 19:32:40 +03:00
Jan Lindström
3307eaab68 MDEV-8582: innodb_force_primary_key option does not force PK or unique key
Analysis: Handler table flag HA_REQUIRE_PRIMARY_KEY alone is not enough
to force primary or unique key, if table has at least one NOT NULL
column and secondary key for that column.

Fix: Add additional check that table really has primary key or
unique key for InnoDB terms.
2015-08-08 10:39:01 +03:00
Jan Lindström
05bcb088bf MDEV-8583: Empty lines in encryption logging
Removed extra line break.
2015-08-08 10:09:45 +03:00
Jan Lindström
18b0176a05 MDEV-8410: Changing file-key-management to example-key-management causes crash and no real error
MDEV-8409: Changing file-key-management-encryption-algorithm causes crash and no real info why

Analysis: Both bugs has two different error cases. Firstly, at startup
when server reads latest checkpoint but requested key_version,
key management plugin or encryption algorithm or method is not found
leading corrupted log entry. Secondly, similarly when reading system
tablespace if requested key_version, key management plugin or encryption
algorithm or method is not found leading buffer pool page corruption.

Fix: Firsly, when reading checkpoint at startup check if the log record
may be encrypted and if we find that it could be encrypted, print error
message and do not start server. Secondly, if page is buffer pool seems
corrupted but we find out that there is crypt_info, print additional
error message before asserting.
2015-08-08 09:56:07 +03:00
Nirbhay Choubey
5b9dd459fb Merge tag 'mariadb-5.5.45' into 5.5-galera 2015-08-07 17:02:51 -04:00
Sergei Golubchik
1610c4285a Merge branch 'bb-10.0-jan' into 10.0
5.5 with our InnoDB changes
2015-08-05 00:02:46 +02:00
Jan Lindström
d71b584069 Fix merge error. 2015-08-04 08:33:31 +03:00
Jan Lindström
9a5787db51 Merge commit '96badb16afcf' into 10.0
Conflicts:
	client/mysql_upgrade.c
	mysql-test/r/func_misc.result
	mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
	mysql-test/suite/innodb/r/innodb-fk.result
	mysql-test/t/subselect_sj_mat.test
	sql/item.cc
	sql/item_func.cc
	sql/log.cc
	sql/log_event.cc
	sql/rpl_utility.cc
	sql/slave.cc
	sql/sql_class.cc
	sql/sql_class.h
	sql/sql_select.cc
	storage/innobase/dict/dict0crea.c
	storage/innobase/dict/dict0dict.c
	storage/innobase/handler/ha_innodb.cc
	storage/xtradb/dict/dict0crea.c
	storage/xtradb/dict/dict0dict.c
	storage/xtradb/handler/ha_innodb.cc
	vio/viosslfactories.c
2015-08-03 23:09:43 +03:00