Commit graph

1257 commits

Author SHA1 Message Date
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
Sergei Golubchik
4f479fb13f Merge branch 'merge-xtradb-5.6' into 10.0
XtraDB 5.6.25-73.1
2015-08-03 14:03:46 +02:00
Sergei Golubchik
17a4a39c15 Merge branch 'merge-xtradb-5.5' into 5.5
5.5.44-37.3
2015-08-01 15:08:33 +02:00
Sergei Golubchik
0b3eb4559b 5.6.25-73.1 2015-08-01 15:04:20 +02:00
Sergei Golubchik
1b0c81c917 5.5.44-37.3 2015-08-01 15:02:14 +02:00
Jan Lindström
360e597c3c Make sure name buffer has string end marker on correct place. 2015-07-31 12:07:23 +03:00
Jan Lindström
fa765a4525 MDEV-6697: Improve foreign keys warnings/errors
There is several different ways to incorrectly define
foreign key constraint. In many cases earlier MariaDB
versions the error messages produced by these cases
are not very clear and helpful. This patch improves
the warning messages produced by foreign key parsing.
2015-07-31 08:59:13 +03:00
Jan Lindström
e05cd97b8a MDEV-8524: Improve error messaging when there is duplicate key or foreign key names
Added better error message that will be printed when foreign key
constraint name in create table is not unique in database.
2015-07-31 08:59:13 +03:00
Jan Lindström
53623d932a MDEV-8522: InnoDB: Assertion failure in file fil0fil.cc line 475
Analysis: In fil_crypt_space_needs_rotation we first make sure that
tablespace is found and then separately that it is normal tablespace.
Thus, tablespace could be dropped between these two functions calls.

Fix: If space is not found from fil_system return tablespace type
ULINT_UNDEFINED and naturally do not continue rotating space.
2015-07-22 08:42:52 +03:00
Jan Lindström
62b5a56191 MDEV-8501: encryption.create_or_replace fails in buildbot on P8 builders
Analysis: There is race between drop table and encryption threads that
could cause encryption thread to enter mutex that has been already
released.

Fix: When destroying crypt_data first enter the mutex and set crypt data
unavailable, then release the memory and clean up the data. This should
make the race more unprobable. Additionally, added big_test for
create_or_replace as it could fail testcase timeout
if you have slow I/O (tested that testcase passes with --mem).
2015-07-21 12:51:14 +03:00
Jan Lindström
7a9670218b MDEV-8474: InnoDB sets per-connection data unsafely
Analysis: At check_trx_exists function InnoDB allocates
a new trx if no trx is found from thd but this newly
allocated trx is not registered to thd. This is unsafe,
because nothing prevents InnoDB plugin from being uninstalled
while there's active transaction. This can cause crashes, hang
and any other odd behavior. It may also corrupt stack, as
functions pointers are not available after dlclose.

Fix: The fix is to use thd_set_ha_data() when
manipulating per-connection handler data. It does appropriate
plugin locking.
2015-07-21 12:12:58 +03:00
Nirbhay Choubey
dced5146bd Merge branch '10.0-galera' into 10.1 2015-07-14 16:05:29 -04:00
Jan Lindström
6efdc398ba MDEV-8463: 10.0 tree does not build
Merge error on srv0start.cc
2015-07-14 20:36:23 +03:00
Jan Lindström
a9960ef0ec MDEV-8386: MARIADB creates very big tmp file > 351Gb. Started happening after Version 10.0.16-15
Fixed small size limit and added additional information if we reserve
new pages more then 50 times.
2015-07-14 20:14:48 +03:00
Jan Lindström
0a43236fbe Code cleanup. 2015-07-14 20:14:48 +03:00
josh4trunks
a95be9644a Apply fix for raw devices to XtraDB 2015-07-12 19:53:38 -07:00
josh4trunks
ee5633a39e Apply fix for raw devices to XtraDB 2015-07-12 19:46:29 -07:00
Jan Lindström
28a8ba089f Fix test failure seen on P7/P8 innodb-encrypt-tables update/validate
function used incorrect type.
2015-07-02 12:02:27 +03:00
Jan Lindström
447416d1f3 MDEV-8406: Test failure on encryption.innodb-page_encryption_log_encryption in P7/P8
Used wrong type for encryption_key_id and page_compression_level in
table options. Make explicit casts for calls also.
2015-07-01 16:24:29 +03:00
Jan Lindström
1a8cf15d63 MDEV-8392: Couldn't alter field with default value for make it not nullable.
Analysis; Problem is that InnoDB does not have support for generating
CURRENT_TIMESTAMP or constant default.

Fix: Add additional check if column has changed from NULL -> NOT NULL
and column default has changed. If this is is first column definition
whose SQL type is TIMESTAMP and it is defined as NOT NULL and
it has either constant default or function default we must use
"Copy" method for alter table.
2015-06-30 22:24:37 +03:00
Jan Lindström
84cefe2455 MDEV-8396: InnoDB: Assertion failure in file fil0crypt.cc line 2052
Logic error, NULL pointer was referenced.
2015-06-30 18:49:47 +03:00
Jan Lindström
d1307bde65 MDEV-8395: InnoDB: Assertion failure in file fil0pagecompress.cc line 539 (SIGFPE)
File block size might be 0 and used on modulo operator. Make sure that
file block size is initialized to 512.
2015-06-30 18:49:47 +03:00
Jan Lindström
79af0b3823 MDEV-8393: InnoDB: Assertion failure in file fil0crypt.cc line 2109
Crypt data was used when it was already freed. Delete crypt data
more thorougly when freed.
2015-06-29 14:10:37 +03:00
Jan Lindström
4fac626917 MDEV-8390: innodb.innodb-flush-changed-page-bitmaps crashes
Analysis: Flush changed page bitmaps calls log_online_follow_redo_log
that later calls log_group_read_log_seg with release_mutex = true
and that causes the log_sys mutex being released before
log_decrypt_after_read function that later required log_sys mutex.

Fix: Enter log_sys mutex before log_decrypt_after_read if mutex
is released and release the mutex after the function if we
acquired it before function call.
2015-06-29 12:48:42 +03:00
Sergei Golubchik
658992699b Merge tag 'mariadb-10.0.20' into 10.1 2015-06-27 20:35:26 +02:00
Sergei Golubchik
fe7e334f3e cleanup: remove unused function argument 2015-06-27 09:40:57 +02:00
Sergei Golubchik
ff7a1ff6d7 fix printf format string 2015-06-27 09:40:54 +02: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
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
Sergey Vojtovich
2b253ed41f MDEV-8324 - MariaDB fails to build with performance schema disabled
Various fixes to let MariaDB compile with performance schema disabled.
2015-06-19 15:06:33 +04:00
Jan Lindström
f5ddffd83e MDEV-8156: Assertion failure in file log0crypt.cc line 220 on server restart
Instead of asserting print informative error message to error log
and return failure from innodb_init causing the server to shutdown.
2015-06-18 20:01:00 +03: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
Jan Lindström
b94eaff8d9 MDEV-8310: Encryption bogus message still in 10.1.5
Moved warning print to debug builds only because on production
these messages are unnecessary.
2015-06-17 09:12:26 +03:00
Jan Lindström
27f0bd7d95 Fix test case innodb.xa_recovery crash on xtradb. 2015-06-16 17:33:21 +03:00
Jan Lindström
96806025eb Fix test failure on main.partition_innodb. 2015-06-16 16:20:55 +03:00
Jan Lindström
ababe047f8 Fix crash on test innodb.innodb-virtual-columns. We should create
only columns really stored to database.
2015-06-16 15:16:53 +03:00
Sergei Golubchik
5355972b71 after merge fixes: InnoDB and XtraDB 2015-06-16 12:49:00 +02:00
Sergei Golubchik
9859d366b5 Merge branch 'merge-xtradb-5.6' into 10.0 2015-06-16 12:46:14 +02:00
Sergei Golubchik
90849456d7 5.6.24-72.2 2015-06-16 11:04:40 +02:00
Jan Lindström
fc31e3114b MDEV-8179: Absent progress report for operations on InnoDB tables
Add progress info on InnoDB/XtraDB row0merge phase. Note that we
do not know exact number of rounds merge sort needs at start thus
also progress report might not be accurate.
2015-06-14 17:32:21 +03:00
Sergei Golubchik
810cf362ea Merge branch '5.5' into 10.0 2015-06-11 20:20:35 +02:00
Jan Lindström
70b82efd20 MDEV-8273: InnoDB: Assertion failure in file fil0pagecompress.cc line 532
Analysis: Problem was that actual payload size (page size) after compression
was handled incorrectly on encryption. Additionally, some of the variables
were not initialized.

Fixed by encrypting/decrypting only the actual compressed page size.
2015-06-09 11:35:21 +03:00
Jan Lindström
4a6a61cb81 MDEV-8268: InnoDB: Assertion failure in file buf0buf.cc line 5842 failing assertion ut_a(free_slot != NULL);
Analysis: Problem is that there is not enough temporary buffer slots
for pending IO requests.

Fixed by allocating same amount of temporary buffer slots as there
are max pending IO requests.
2015-06-09 11:35:21 +03:00
Jan Lindström
d7f3d889de MDEV-8272: Encryption performance: Reduce the number of unused memcpy's
Removed memcpy's on cases when page is not encrypted and make sure
we use the correct buffer for reading/writing.
2015-06-09 11:35:21 +03:00
Olivier Bertrand
f8fa5fe1bc Commit merge resolve 2015-06-05 23:24:39 +02: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
750aa8b09d 5.5.43-37.2 2015-06-04 18:58:12 +02:00
Jan Lindström
a8b8544a03 MDEV-7906: InnoDB: Failing assertion: prebuilt->sql_stat_start || trx->state == 1 on concurrent multi-table update
Analysis: Problem is that SQL-layer calls handler API after storage
engine has already returned error state. InnoDB does internal
rollback when it notices transaction error (e.g. lock wait timeout,
deadlock, etc.) and after this transaction is not naturally in
correct state to continue.

Fix: Do not continue fetch operations if transaction is not started.
2015-06-04 15:02:24 +03: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
432b78c903 just like tempfiles: use key id 2 for temp Aria tables
introduce ENCRYPTION_KEY_SYSTEM_DATA and
ENCRYPTION_KEY_TEMPORARY_DATA constants; use them everywhere.
2015-06-02 18:53:37 +02:00
Sergei Golubchik
72d01f2426 remove few #ifdefs in innodb/xtradb 2015-06-02 17:46:05 +02:00
Sergei Golubchik
d602574542 Merge remote-tracking branch 'github/10.1' into 10.1 2015-06-01 16:01:42 +02:00
Sergei Golubchik
5091a4ba75 Merge tag 'mariadb-10.0.19' into 10.1 2015-06-01 15:51:25 +02:00
Jan Lindström
13235a549d Fix compiler warning. 2015-05-31 07:53:20 +03:00
Jan Lindström
59815a268b MDEV-7484: Log Time not consistent with InnoDB errors nor with MySQL error log time format 2015-05-30 20:45:17 +03: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
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
Sergey
6bd76f8b7e Merge pull request #73 from akopytov/MDEV-7658-5.5
Fixes MDEV-7658: MDEV-7026 fix reintroduces MDEV-6615 on AArch64
2015-05-27 10:27:18 +04:00
Jan Lindström
a99efc00a6 Merge pull request #74 from akopytov/MDEV-7658-10.0
Mdev 7658 10.0
2015-05-27 09:16:24 +03:00
Alexey Kopytov
7f7cee8700 Merge branch 'MDEV-7658-5.5' into MDEV-7658-10.0 2015-05-26 23:58:51 +03:00
Alexey Kopytov
70bc0a3ef4 Fixes MDEV-7658: MDEV-7026 fix reintroduces MDEV-6615 on AArch64
This is an addendum to the fix for MDEV-7026. The ARM memory model is
similar to that of PowerPC and thus needs the same semantics with
respect to memory barriers. That is, os_atomic_test_and_set_*_release()
must be a store with a release barrier followed by a full
barrier. Unlike x86 using __sync_lock_test_and_set() which is
implemented as “exclusive load with acquire barriers + exclusive store”
is insufficient in contexts where os_atomic_test_and_set_*_release()
macros are used.
2015-05-26 23:56:00 +03:00
Jan Lindström
8c0ea281bf MDEV-8213: encryption.encryption_force, encryption.encrypt_and_grep fail with valgrind warnings (Invalid read)
Analysis: Problem was that code used old pointer.

Fixed by using correct pointer.
2015-05-26 16:09:36 +03:00
Jan Lindström
536112dd30 MDEV-8195: InnoDB: Error: trying to access tablespace 11262 page no. 7, InnoDB: but the tablespace does not exist or is just being dropped.
Analysis: Problem was that we did try to read from tablespace
that was being dropped.

Fixed by introducing a new function to find a tablespace only
if it is not being dropped currently and adding this check
before trying to read pages from tablespace.
2015-05-21 15:32:49 +03:00
Jan Lindström
925b64124a MDEV-8182: Failing assertion: 1 == UT_LIST_GET_LEN(space->chain)
Analysis: At fil_spage_get_space there is small change that space
is found from tablespace list but we have not yet created node
for it (and added it to space->chain) and as we hold fil_system
mutex here fil_node_create can't continue.

Fixed by allowing UT_LIST_GET_LEN(space->chain) == 0|| 1 and
introducint two new functions that access filespace list
and before returning space check that node is also created.
2015-05-20 20:32:10 +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
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
Sergei Golubchik
54672a4f1e MDEV-8043 innodb tablespace encryption
"use after free" bug, when a thread replaces space->crypt_data
and frees the old crypt_data object while it's being used
by another thread.
2015-05-15 18:12:03 +02:00
Sergei Golubchik
e5989d52a7 InnoDB: simplify innobase_compression_algorithm_validate() 2015-05-15 18:12:03 +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
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
def48e623a MDEV-8141 InnoDB: background encryption thread uses FIL_DEFAULT_ENCRYPTION_KEY
* check key version per key id (that is, per tablespace).
* wake encryption thread when a tablespace needs re-encryption
2015-05-13 14:27:17 +02:00
Sergei Golubchik
a583976e78 MDEV-8015 InnoDB: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
InnoDB: refuse to start if encryption is requested but no
encryption plugin is available
2015-05-13 14:27:17 +02:00
Sergei Golubchik
b4777bfc11 cleanup, use encryption_key_id_exists() where appropriate 2015-05-13 14:27:17 +02:00
Jan Lindström
58e8db2eb3 MDEV-7942: InnoDB: abuse of UNIV_LIKELY()/UNIV_UNLIKELY()
UNIV_LIKELY()/UNIV_UNLIKELY() hints are supposed to improve branch prediction.
Currently, they're expected to work only if cond evaluates to TRUE or FALSE.

However there're a few conditions that may evaluate to different values, e.g.:

page/page0zip.cc:		if (UNIV_LIKELY(c_stream->avail_in)) {
page/page0zip.cc:			if (UNIV_LIKELY(c_stream->avail_in)) {
dict/dict0mem.cc:		if (UNIV_LIKELY(i) && UNIV_UNLIKELY(!table->col_names)) {

Fixed these conditions so that they evaluate TRUE/FALSE.
2015-05-11 14:31:42 +03:00
Jan Lindström
ecfc3de57e MDEV-8129: Compilation warnings in log0crypt.cc
Fix incorrect types and compiler warnings.
2015-05-11 12:22:13 +03:00
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
Jan Lindström
d259376fd8 MDEV-8041: InnoDB redo log encryption
Merged new version of InnoDB/XtraDB redo log encryption from Google
provided by Jonas Oreland.
2015-05-09 11:13:00 +03:00
Alexey Yurchenko
4ed9ddd30e Refs codership/mysql-wsrep#33
1. factored XID-related functions to a separate wsrep_xid.cc unit.
  2. refactored them to take refrences instead of pointers where appropriate
  3. implemented wsrep_get/set_SE_position to take wsrep_uuid_t and wsrep_seqno_t instead of XID
  4. call wsrep_set_SE_position() in wsrep_sst_received() to reinitialize SE checkpoint after SST was received, avoid assert() in setting code by first checking current position.
2015-05-08 17:41:06 -04:00
sjaakola
226c249ab3 refs codership/mysql-wsrep#53 - fencing LOAD DATA splitting related commit to not happen with ALTER processing 2015-05-08 17:41:06 -04:00
sjaakola
91417b4047 refs #7 - merged fix from 5.5 branch. However, 5.6 branch has not (yet) surfaced similar applier hang as 5.5 2015-05-08 17:41:04 -04:00
Sergei Golubchik
ac286a9bc7 Merge branch '5.5' into 10.0 2015-05-08 11:20:43 +02: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
8350ea0514 Fix compiler error if compiler does not support c99 style
initializers.
2015-05-07 13:04:03 +03:00
Jan Lindström
b975685036 Merge pull request #54 from openquery/MDEV-8053-c99-style-for-structure-members-10.1
c99 style for assigning structure members
2015-05-06 16:48:17 +03:00
Jan Lindström
f704b3335f Merge pull request #52 from openquery/MDEV-8053-c99-style-for-structure-members
c99 style for assigning structure members
2015-05-06 16:47:23 +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
Jan Lindström
2f25c653ad MDEV-8074: Failing assertion: mutex->magic_n == MUTEX_MAGIC_N in file sync0sync.cc line 508
Problem was that e.g. on crash recovery fil_space_crypt_close_tablespace
and fil_space_crypt_mark_space_closing access mutex that is not yet
initialized. Mutex is naturally initialized only if encryption is
configured.
2015-05-06 14:11:30 +03:00
Sergei Golubchik
5dcb111c38 Merge branch 'Buggynours:10.0' into 10.0 2015-05-05 07:50:31 +02:00
Sergei Golubchik
bbcc8e6924 XtraDB-5.6.23-72.1 2015-05-05 00:08:58 +02:00
Sergei Golubchik
a4416abdde 5.6.23-72.1 2015-05-04 22:17:04 +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
14a142fca6 move to storage/xtradb 2015-05-04 19:15:28 +02:00
Teemu Ollakka
f6b1e0fe0a refs #55 fixed debug build compilation errors 2015-05-04 13:04:52 -04:00
Nirbhay Choubey
2a6e1230e3 refs #7 - handling lock queue granting in BF-BF conflict situation
Merge fix to xtradb.
2015-05-04 13:04:51 -04:00
Jan Lindström
37093eb51e MDEV-8079: Crash when running MariaDB Debug with InnoDB on Windows
Problem was that std::vector was allocated using calloc instead of
new, this caused vector constructor not being called and vector
metadata not initialized.
2015-05-01 14:51:50 +03:00
Jan Lindström
53382ac128 MDEV-8079: Crash when running MariaDB Debug with InnoDB on Windows
Problem was that std::vector was allocated using calloc instead of
new, this caused vector constructor not being called and vector
metadata not initialized.
2015-05-01 14:23:08 +03:00
Sergei Golubchik
4c87f72773 Merge branch '5.5' into bb-5.5-serg 2015-04-29 16:24:52 +02:00
Nirbhay Choubey
8aa84821b4 MDEV-8057: Galera conflicts with InnoDB buffer pool dump
Avoid creating innodb buffer pool dump/load thread if mysqld is started
with wsrep recovery mode (--wsrep-recover).

(Merged fix for lp:1305955 from lp:percona-xtradb-cluster)
2015-04-28 18:59:11 -04:00
Sergei Golubchik
67a3ddf17a Merge branch 'merge-xtradb-5.5' into 5.5 2015-04-28 13:54:37 +02:00
Sergei Golubchik
40e95608d9 percona-server-5.5.42-37.1.tar.gz 2015-04-28 13:42:58 +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
Sergei Golubchik
fd39c56eff move to storage/xtradb/ 2015-04-27 23:37:51 +02:00
Sergei Golubchik
245cc73452 MDEV-7434 XtraDB does not build on Solaris 2015-04-27 15:42:12 +02:00
Daniel Black
3d801e606b c99 style for assigning structure members 2015-04-27 21:08:52 +10:00
Daniel Black
4d606cb955 c99 style for assigning structure members 2015-04-25 22:57:33 +10:00
Kristian Nielsen
791b0ab5db Merge 10.0 -> 10.1 2015-04-20 13:21:58 +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
Sergei Golubchik
4a7472bbf2 fix a crash in innodb.innodb-wl5522-zip,xtradb
dereferencing of the uninitialized pointer bpade->slot
(when compiled without UNIV_DEBUG)
2015-04-11 00:28:42 +02:00
Sergei Golubchik
a73676b2e6 Merge branch '10.1' into bb-10.1-serg 2015-04-10 19:32:14 +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
dab6c83744 allow srv_encrypt_tables and ENCRYPTED=YES to be used together 2015-04-10 02:51:06 +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
0a9052f591 Store the key id in the tablespace and read it back 2015-04-09 19:36:12 +02:00
Sergei Golubchik
97d5de4ccf Add encryption key id to the API as a distinct concept
which is separate from the encryption key version
2015-04-09 19:35:40 +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
129e960179 fix log_blocks_crypt() to actually decrypt the encrypted log
It used to double-encrypt it, relying on the fact that second
encrypt() call was (like XOR) negating the effect of the
first one.
2015-04-09 19:06:11 +02:00
Sergei Golubchik
d6b912c64d update XtraDB/InnoDB plugin maturity to match the server
because of encryption changes - make it beta and let
it mature together with the server
2015-04-09 18:44:02 +02:00
Sergei Golubchik
f130da7b00 clarify/simplify new innodb sysvars: help texts 2015-04-09 18:42:45 +02:00
Sergei Golubchik
87cf86519e clarify/simplify new innodb sysvars: innodb-scrub-force-testing
rename to innodb-debug-force-scrubbing
2015-04-09 18:42:45 +02:00
Sergei Golubchik
19e76814b7 clarify/simplify new innodb sysvars: innodb-scrub-log-interval
rename to innodb-scrub-log-speed
2015-04-09 18:42:45 +02:00
Sergei Golubchik
72c8b3fcb2 small cleanups as per review 2015-04-09 18:42:44 +02:00
Sergei Golubchik
4d40a7d133 remove now-empty my_aes.{h,cc}
move remaning defines to my_crypt, add MY_ namespace prefix
2015-04-09 18:42:44 +02:00
Sergei Golubchik
65e7826070 renames to follow single consistent naming style
with namespace prefixes
2015-04-09 18:42:44 +02:00
Sergei Golubchik
bb1b61b312 encryption plugin controls the encryption
* no --encryption-algorithm option anymore
* encrypt/decrypt methods in the encryption plugin
* ecnrypt/decrypt methods in the encryption_km service
* file_km plugin has --file-key-management-encryption-algorithm
* debug_km always uses aes_cbc
* example_km changes between aes_cbc and aes_ecb for different key versions
2015-04-09 18:42:43 +02:00
Sergei Golubchik
9ccafffc29 rename "encryption key management plugin" to "encryption plugin"
because it's going to do more than just key management
2015-04-09 18:42:43 +02:00
Sergei Golubchik
6a3932fdd0 use key derivation procedure for all encryption algorithms 2015-04-08 10:58:51 +02:00
Sergei Golubchik
ef5b4889c2 optimize encryption api
only one encryption key lookup in most cases instead of three
(has_key, get_key_size, get_key).
2015-04-08 10:58:50 +02:00
Jan Lindström
4865fd105a InnoDB/XtraDB Encryption cleanup
Step 5:
-- Rename encryption_key -> encryption_key_id
-- Remove unnecessary code
-- Fix few bugs found
-- Fix test cases and results files
2015-04-07 23:44:57 +02:00
Jan Lindström
af768c2f22 InnoDB/XtraDB Encryption code cleanup
Step 4:
-- Review fixes
-- Rename pages_page_* to pages_*
-- Remove unnecessary code
2015-04-07 23:44:57 +02:00
Jan Lindström
71ec0463af Encryption cleanup
Step 3:

-- Make encrytion_algorithm changeable by SUPER
-- Remove AES_ECB method from encryption_algorithms
-- Support AES method change by storing used method on InnoDB/XtraDB objects
-- Store used AES method to crypt_data as different crypt types
-- Store used AES method to redo/undo logs and checkpoint
-- Store used AES method on every encrypted page after key_version
-- Add test
2015-04-07 23:44:57 +02:00
Jan Lindström
0ba9fa35bc InnoDB/XtraDB Encryption cleanup
Step 2:

-- Introduce temporal memory array to buffer pool where to allocate
temporary memory for encryption/compression
-- Rename PAGE_ENCRYPTION -> ENCRYPTION
-- Rename PAGE_ENCRYPTION_KEY -> ENCRYPTION_KEY
-- Rename innodb_default_page_encryption_key -> innodb_default_encryption_key
-- Allow enable/disable encryption for tables by changing
 ENCRYPTION to enum having values DEFAULT, ON, OFF
-- In create table store crypt_data if ENCRYPTION is ON or OFF
-- Do not crypt tablespaces having ENCRYPTION=OFF
-- Store encryption mode to crypt_data and redo-log
2015-04-07 23:44:56 +02:00
Jan Lindström
b4a4d82396 InnoDB/XtraDB Encryption cleanup.
Step 1:
-- Remove page encryption from dictionary (per table
encryption will be handled by storing crypt_data to page 0)
-- Remove encryption/compression from os0file and all functions
before that (compression will be added to buf0buf.cc)
-- Use same CRYPT_SCHEME_1 for all encryption methods
-- Do some code cleanups to confort InnoDB coding style
2015-04-07 23:44:56 +02:00
Jan Lindström
e9c10f9916 MDEV-7908: assertion in innobase_release_savepoint
Problem was that in XA prepared state we should still be able to
release a savepoint, but assertions were too strict.
2015-04-06 17:38:51 +03:00
Jan Lindström
3674c363a7 MDEV-7918: A number of tests fail in valgrind builder with "InnoDB: Error: Requested state 6 current state 4 old_state 4"
Problem with this state transfer is that different state transfers
are protected with different mutexes.
2015-04-06 12:45:35 +03:00
Sergei Golubchik
2f8d101f9e unify my_{en|de}crypt_{cbc|ecb|ctr}. no yassl support yet. 2015-04-05 13:14:37 +02:00
Jan Lindström
b53bcd438f MDEV-7367: Updating a virtual column corrupts table which crashes server
Analysis: MySQL table definition contains also virtual columns. Similarly,
index fielnr references MySQL table fields. However, InnoDB table definition
does not contain virtual columns. Therefore, when matching MySQL key fieldnr
we need to use actual column name to find out referenced InnoDB dictionary
column name.

Fix: Add new function to match MySQL index key columns to InnoDB dictionary.
2015-03-31 09:16:48 +03:00
Jan Lindström
0563f49ba3 MDEV-7754: innodb assert "array->n_elems < array->max_elems" on a huge blob update
Replace static array of thread sync levels with std::vector.
2015-03-31 09:16:48 +03:00
Jan Lindström
cbc5157feb MDEV-7878: innodb_scrub_background fails sporadically in buildbot (Failing assertion: offset > 0 && offset < UNIV_PAGE_SIZE)
Problem was that when encrypted space was flushed page 0 is
also updated but crypt data offset was sometimes not
calculated.
2015-03-31 09:00:01 +03:00
Jan Lindström
3578419b77 MDEV-7797: file_key_management_plugin uses static IV for a key
Currently crypt data is written to file space always. Use
that to obtain random IV for every object (file).

Beatify code to confort InnoDB coding styles.

Conflicts:
	storage/innobase/fil/fil0crypt.cc
	storage/xtradb/fil/fil0crypt.cc
2015-03-20 13:09:07 +02:00
Jan Lindström
b3438f24a1 MDEV-7803: Encryption metadata (crypt_data) is written to InnoDB file space page 0 even when encryption is not enabled 2015-03-19 14:09:49 +02:00
Jan Lindström
bab0bdbb5c Introduce two debug crash points while writing crypt data to test
redo operations.
2015-03-19 07:13:07 +02:00
Jan Lindström
1020d56934 Better and more correct comment. 2015-03-18 15:17:17 +02:00
Jan Lindström
2bdbfd334b Fix assertion failure seen on Buildbot win32-debug
There is a bug in Visual Studio 2010
Visual Studio has a feature "Checked Iterators". In a debug build, every
iterator operation is checked at runtime for errors, e g, out of range.
Disable this "Checked Iterators" for Windows and Debug if defined.
2015-03-18 12:18:39 +02:00
Jan Lindström
c14d9c21f0 Make sure that sync level vector is emptied. 2015-03-18 06:25:10 +02:00
Jan Lindström
99a2c061d7 MDEV-7754: innodb assert "array->n_elems < array->max_elems" on a huge blob update
Problem was that static array was used for storing thread mutex sync levels.
Fixed by using std::vector instead.

Does not contain test case to avoid too big memory/disk space usage
on buildbot VMs.
2015-03-17 20:35:05 +02:00
Olivier Bertrand
73d0427553 Changes to avoid compiling error with Visual Studio 2008
Adding files to ignore
2015-03-16 17:22:50 +01:00
Jan Lindström
c4b268add0 InnoDB cleanup. Remove empty statements i.e. extra ; characters. 2015-03-16 09:14:13 +02:00
Kristian Nielsen
184f718fef MDEV-7249: Performance problem in parallel replication with multi-level slaves
Parallel replication (in 10.0 / "conservative" mode) relies on binlog group
commits to group transactions that can be safely run in parallel on the
slave. The --binlog-commit-wait-count and --binlog-commit-wait-usec options
exist to increase the number of commits per group. But in case of conflicts
between transactions, this can cause unnecessary delay and reduced througput,
especially on a slave where commit order is fixed.

This patch adds a heuristics to reduce this problem. When transaction T1 goes
to commit, it will first wait for N transactions to queue up for a group
commit. However, if we detect that another transaction T2 is waiting for a row
lock held by T1, then we will skip the wait and let T1 commit immediately,
releasing locks and let T2 continue.

On a slave, this avoids the unfortunate situation where T1 is waiting for T2
to join the group commit, but T2 is waiting for T1 to release locks, causing
no work to be done for the duration of the --binlog-commit-wait-usec timeout.

(The heuristic seems reasonable on the master as well, so it is enabled for
all transactions, not just replication transactions).
2015-03-13 14:01:52 +01:00
Jan Lindström
4d0e52189c MDEV-7770: Online DDL progress output contains incorrectly printed index names
Index names were not formatted correctly.
2015-03-13 09:38:08 +02:00
Jan Lindström
702fdc52fa MDEV-7714: Make possible to get innodb internal primary key for wrapper
type storage engine.

Authored by: Kentoku Shiba
2015-03-12 18:37:32 +02:00
Jan Lindström
9f4ee16bf3 MDEV-7619: Improve long semaphore wait output
Add holder thread_id, file_name and line to output.
2015-03-11 07:31:57 +02:00
Jan Lindström
c8035da9b8 Add more information if page state is not correct. 2015-03-10 14:05:57 +02:00
Jan Lindström
a7fd11b31d MDEV-7685: MariaDB - server crashes when inserting more rows than
available space on disk

Add error handling when disk full situation happens and
intentionally bring server down with stacktrace because
on all cases InnoDB can't continue anyway.
2015-03-09 18:33:25 +02:00
Jan Lindström
040027c888 MDEV-7627 :Some symbols in table name can cause to Error Code: 1050
when created FK

Analysis: Table name is on filename charset but foreign key
identifiers are not. This lead incorrect foreign key
identifier number to be used.

Fix: Convert foreign key identifier to filename charset before
comparing it to table name when largest foreign key identifier
number is resolved.
2015-03-09 09:47:25 +02:00
Jan Lindström
6c19f51a5f MDEV-7672: Crash creating an InnoDB table with foreign keys
Analysis: after a red-black-tree lookup we use node withouth
checking did lookup succeed or not. This lead to situation
where NULL-pointer was used.

Fix: Add additional check that found node from red-back-tree
is valid.
2015-03-07 22:56:33 -05:00
Sergei Golubchik
2db62f686e Merge branch '10.0' into 10.1 2015-03-07 13:21:02 +01:00
Sergei Golubchik
5f510a9175 Merge branch '5.5' into 10.0 2015-03-06 18:41:32 +01:00
Sergei Golubchik
17a37796e1 after innodb/xtradb merge: use the correct visibility for internal functions
otherwise innodb plugin might invoke xtradb function with the same name,
and that might crash (./mtr --emb innodb.strict_mode)
2015-03-06 18:13:06 +01:00
Jan Lindström
206b111b11 MDEV-7672: Crash creating an InnoDB table with foreign keys
Analysis: after a red-black-tree lookup we use node withouth
checking did lookup succeed or not. This lead to situation
where NULL-pointer was used.

Fix: Add additional check that found node from red-back-tree
is valid.
2015-03-06 11:19:23 +02:00
Sergey Vojtovich
e13459a11e MDEV-7148 - Recurring: InnoDB: Failing assertion: !lock->recursive
Re-applied lost in the merge revision:
commit ed313e8a92
Author: Sergey Vojtovich <svoj@mariadb.org>
Date:   Mon Dec 1 14:58:29 2014 +0400

    MDEV-7148 - Recurring: InnoDB: Failing assertion: !lock->recursive

    On PPC64 high-loaded server may crash due to assertion failure in InnoDB
    rwlocks code.

    This happened because load order between "recursive" and "writer_thread"
    wasn't properly enforced.
2015-03-05 15:30:11 +04:00
Jan Lindström
f66fbe8ce0 MDEV-7578 :Slave is ~10x slower to execute set of statements compared to master when using RBR
Analysis: On master when executing (single/multi) row INSERTs/REPLACEs
InnoDB fallback to old style autoinc locks (table locks)
only if another transaction has already acquired the AUTOINC lock.
Instead on slave as we are executing log_events and sql_command
is not correctly set, InnoDB does not use new style autoinc
locks when it could.

Fix: Use new style autoinc locks also when
thd_sql_command(user_thd) == SQLCOM_END i.e. this is RBR event.
2015-03-05 12:05:59 +02:00
Buggynours
eb2f763872 Add #include <ostream> in dict0mem.h and change iterator to const_iterator in dic0mem.cc
This fix compiling error when compiled with Visual Studio 9 2008
2015-03-03 12:39:42 +01:00
Jan Lindström
7047bef1ef Use standard InnoDB error mechanism on compression and encryption
error messages.
2015-03-02 10:55:48 +02:00
Sergei Golubchik
c3f80a2bff fix new innodb warnings to use the standard innodb warning syntax 2015-03-01 16:53:31 +01:00
Nirbhay Choubey
af651c80f7 Merge tag 'mariadb-10.0.17' into 10.0-galera
Conflicts:
	storage/innobase/include/trx0trx.h
2015-02-27 17:36:54 -05:00
Jan Lindström
2eae6848d9 MDEV-7572: InnoDB: Assertion failure in log_init_crypt_key if
file_key_management_plugin is used

Fixed error handling and added disabling InnoDB redo log encryption
if encryption key management plugin is not there.
2015-02-26 10:17:23 +02:00
Sergei Golubchik
6c09a72af5 Merge remote-tracking branch 'origin/10.0' into 10.0 2015-02-24 20:52:37 +01:00
Jan Lindström
8799f87075 MDEV-7623: Add lock wait time and hold time to every record/table lock in
InnoDB transaction lock printout.
2015-02-24 10:33:49 +02:00
Jan Lindström
90635c6fb5 MDEV-7620: Transaction lock wait is missing number of lock
waits and total wait time.
2015-02-23 11:24:19 +02:00
Sergei Golubchik
f2cb45daf3 Merge remote-tracking branch 'origin/10.0' into 10.0 2015-02-22 21:45:24 +01:00
Jan Lindström
1cc7befc14 MDEV-7109: Add support for INFORMATION_SCHEMA.INNODB_SEMAPHORE_WAITS
MDEV-7399: Add support for INFORMATION_SCHEMA.INNODB_MUTEXES
    MDEV-7618: Improve semaphore instrumentation

    Introduced two new information schema tables to monitor mutex waits
    and semaphore waits. Added a new configuration variable
    innodb_intrument_semaphores to add thread_id, file name and
    line of current holder of mutex/rw_lock.
2015-02-21 21:45:16 +02:00
Jan Lindström
9152b83973 Merged from 10.0-FusionIO:
Added support for compression method snappy for page compression.
2015-02-19 17:42:18 +02:00
Nirbhay Choubey
860576f416 Merge branch '10.0' into 10.0-galera
Merge branch 10.0 till revision:
f37bdd9 - Merge remote-tracking branch 'github/10.0' into 10.0

Conflicts:
	.bzrignore
	storage/xtradb/CMakeLists.txt
2015-02-18 18:07:45 -05:00
Nirbhay Choubey
3c9137deeb Merge branch '5.5' into 5.5-galera
Merge banch 5.5 till revision :
fdd6c11 - MDEV-7419 Function cli_safe_read not exported

Conflicts:
	.bzrignore
	debian/dist/Debian/mariadb-galera-server-5.5.files.in
	debian/dist/Ubuntu/mariadb-galera-server-5.5.files.in
	storage/tokudb/CMakeLists.txt
	support-files/build-tags
2015-02-18 17:15:57 -05:00
Sergei Golubchik
174bccd3ff xtradb 5.6.22-72.0 2015-02-18 20:31:40 +01:00
Sergei Golubchik
d7e7862364 Merge branch '5.5' into 10.0 2015-02-18 15:16:27 +01:00
Jan Lindström
4040bf18cf MDEV-7593: Default encryption key does not work correctly for page
encrypted tables

Introduced a new innodb_default_page_encryption_key configuration
variable to allow user to set the default key identifier.
2015-02-18 08:32:01 +02:00
Sergei Golubchik
a0e93bceb7 innodb/xtradb: update nonnull attributes to match the new semantics 2015-02-17 23:49:02 +01:00
Jan Lindström
a1a32f8f25 Revert file space allocation change on row0merge.cc. 2015-02-18 06:59:28 +02:00
Sergei Golubchik
db227616d2 followup for "MDEV-6248 GUI-friendly cmake options to enable/disable plugins"
Remove ONLY_IF clause in MYSQL_ADD_PLUGIN and the requirement
that every plugin's CMakeLists.txt *must* do MYSQL_ADD_PLUGIN
for PLUGIN_XXX=YES to work. This was very fragile and cannot be
relied on.

Use a different implementation of =YES check - iterate all
PLUGIN_* variables and see which one doesn't have a matching target.

Revert all ONLY_IF changes in CMakeLists.txt files.
2015-02-15 22:14:33 +01:00
Jan Lindström
454beee5fb MDEV-6288 :Innodb causes server crash after disk full, then can't ALTER TABLE any more
Fix try to avoid unnecessary crashes when disk full situation is reached
on alter table.
2015-02-13 11:49:31 +02:00
Sergei Golubchik
5dce6aa1fe Merge remote-tracking branch 'bzr/5.5' into bb-5.5-merge 2015-02-12 13:14:55 +01:00
Sergei Golubchik
2a1be9cdf8 XtraDB 5.5.41-37.0 2015-02-11 20:40:56 +01:00
Jan Lindström
0ed60af423 Fix test failure seen on p8-rhel7 2015-02-11 19:52:43 +02:00
Jan Lindström
56da6252f7 Improve InnoDB transaction lock output by providing number of table locks
this transaction is currently holding and total number of table locks to
the table where lock is held.
2015-02-10 15:15:27 +02:00
Jan Lindström
093b232a87 Do not yet allow encrypted tables with compressed tables. 2015-02-10 10:21:19 +01:00
Jan Lindström
e2e809860e Pass down the information should we encrypt the page at os0file.cc
when page compression and google encryption is used.
2015-02-10 10:21:18 +01:00
Jan Lindström
faad7e0c18 Add test case for combination Google encryption and page compressed tables. 2015-02-10 10:21:18 +01:00
Sergei Golubchik
21430e4378 encryption keys service 2015-02-10 10:21:18 +01:00
Sergei Golubchik
cf8bf0b68e encryption key management plugin api 2015-02-10 10:21:17 +01:00