Commit graph

17262 commits

Author SHA1 Message Date
Sergei Golubchik
3a4242fd57 TokuDB: Don't free P_S instrumented mutexes after exit()
don't create static objects that destroy mutexes from destructors,
and don't destroy mutexes from .so destructor (on-unload) function.

if it happens after exit(), P_S will be long gone by that time

this fixes tokudb tests crashing on quantal-amd64
2018-09-06 21:06:31 +02:00
Oleksandr Byelkin
d527bf5390 Merge branch 'merge-tokudb-5.6' into 10.0 2018-09-06 21:04:56 +02:00
Sergei Golubchik
d831cefb43 MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
Disable "Invalid (old?) table or database name" warning when
converting table names in InnoDB's get_foreign_key_info().

Because a name can be a temporary table name during the ALTER TABLE,
and some other thread can do SHOW CREATE TABLE for the other table
in the FK relationships _anytime_.
2018-09-04 09:49:53 +02:00
Sergei Golubchik
22bcfa011a cleanup: FOREIGN_KEY_INFO
instead of returning strings for CASCADE/RESTRICT
from every storage engine, use enum values

Backport of a3614d33e8
2018-09-04 08:37:44 +02:00
Oleksandr Byelkin
a816eac92a 5.6.41-84.1 2018-09-03 16:29:29 +02:00
Oleksandr Byelkin
b9bc3c2463 Merge branch '5.5' into 10.0 2018-09-03 10:57:02 +02:00
Monty
43c393ff47 MDEV-16682 Assertion `(buff[7] & 7) == HEAD_PAGE' failed
Missed one file in last push...
2018-09-03 11:10:46 +03:00
Vicențiu Ciorbaru
51fb163b6d Fix clang warning of mismatched new[] and delete[]
Warning:
'delete' applied to a pointer that was allocated with 'new[]';
did you mean 'delete[]'?
2018-08-25 18:27:57 +03:00
Daniel Black
6b22cc4ae0 connect engine: GetStringUTFChars takes pointer arg
Avoids compile errors of the form:

/storage/connect/jdbconn.cpp:1473:41: error: cannot initialize a parameter of type 'jboolean *' (aka 'unsigned char *') with an rvalue of type 'jboolean' (aka 'unsigned char')
   name = env->GetStringUTFChars(label, (jboolean)false);
                                        ^~~~~~~~~~~~~~~
/usr/lib/jvm/java-8-oracle/include/jni.h:1616:58: note: passing argument to parameter 'isCopy' here
    const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
2018-08-25 18:27:14 +03:00
Marko Mäkelä
9dfef6e29b Fix -Wclass-memaccess warnings in InnoDB,XtraDB 2018-08-03 11:53:57 +03:00
Marko Mäkelä
b963cbaf4b Follow-up fix to MDEV-16865: InnoDB fts_query() ignores KILL
fts_query(): Remove a redundant condition (result will never be NULL),
and instead check if *result is NULL, to prevent SIGSEGV in
fts_query_free_result().
2018-08-03 11:49:49 +03:00
Marko Mäkelä
a7f84f09bf MDEV-16865 InnoDB fts_query() ignores KILL
The functions fts_ast_visit() and fts_query() inside
InnoDB FULLTEXT INDEX query processing are not checking
for THD::killed (trx_is_interrupted()), like anything
that potentially takes a long time should do.

This is a port of the following change from MySQL 5.7.23,
with a completely rewritten test case.

commit c58c6f8f66ddd0357ecd0c99646aa6bf1dae49c8
Author: Aakanksha Verma <aakanksha.verma@oracle.com>
Date:   Fri May 4 15:53:13 2018 +0530

Bug #27155294 MAX_EXECUTION_TIME NOT INTERUPTED WITH FULLTEXT SEARCH USING MECAB
2018-08-01 08:43:12 +03:00
Marko Mäkelä
b3e95086e1 Fix function pointer type mismatch 2018-08-01 08:43:12 +03:00
Marko Mäkelä
e52315a4a2 MDEV-16855 Fix fts_sync_synchronization in InnoDB
This is a backport of the following fix from MySQL 5.7.23.
Some code refactoring has been omitted, and the test case has
been adapted to MariaDB.

commit 7a689acaa65e9d602575f7aa53fe36a64a07460f
Author: Krzysztof Kapuścik <krzysztof.kapuscik@oracle.com>
Date:   Tue Mar 13 12:34:03 2018 +0100

Bug#27082268 Invalid FTS sync synchronization

The fix closes two issues:
Bug #27082268 - INNODB: FAILING ASSERTION: SYM_NODE->TABLE != NULL DURING FTS SYNC
Bug #27095935 - DEADLOCK BETWEEN FTS_DROP_INDEX AND FTS_OPTIMIZE_SYNC_TABLE

Both issues were related to a FTS cache sync being done during
operations that perfomed DDL actions on internal FTS tables
(ALTER TABLE, TRUNCATE). In some cases the FTS tables and/or
internal cache structures could get removed while still being
used to perform FTS synchronization leading to crashes. In other
the sync operations could not get finishes as it was waiting for
dict lock which was taken by thread waiting for the background
sync to be finished.

The changes done includes:
- Stopping background operations during ALTER TABLE and TRUNCATE.
- Removal of unused code in FTS.
- Cleanup of FTS sync related code to make it more readable and
easier to maintain.

RB#18262
2018-07-30 18:06:30 +03:00
Marko Mäkelä
5ed2da9587 Apply the 5.6.40 security fixes to XtraDB
We did not merge Percona XtraDB 5.6.40-84.0 yet.
The changes in it are mostly cosmetic, except for
2 bug fixes from Oracle MySQL 5.6.40, which could
be security bugs.

This was achieved by taking the applicable parts
of an earlier InnoDB commit to XtraDB:

git diff 15ec8c2f28f08517ecbffb959d756b4bdd53ab45{~,} storage/innobase|
sed -e s+/innobase/+/xtradb/+|patch -p1
2018-07-30 16:28:20 +03:00
Marko Mäkelä
7c773abdf7 Merge 5.5 into 10.0 2018-07-30 15:44:31 +03:00
Karthik Kamath
a49ec98042 2018-07-30 15:32:22 +03:00
Marko Mäkelä
4c21c367b3 Merge InnoDB MySQL 5.6.41 to 10.0 2018-07-30 15:21:11 +03:00
Sachin Agarwal
29ddc6e9e3 Bug #27326796 - MYSQL CRASH WITH INNODB ASSERTION FAILURE IN FILE PARS0PARS.CC
Problem:
As part of bug #24938374 fix, dict_operation_lock was not taken by
fts_optimize_thread while syncing fts cache.
Due to this change, alter query is able to update SYS_TABLE rows
simultaneously. Now when fts_optimizer_thread goes open index table,
It doesn't open index table if the record corresponding to that table is
set to REC_INFO_DELETED_FLAG in SYS_TABLES and hits an assert.

Fix:
If fts sync is already in progress, Alter query would wait for sync to
complete before renaming table.

RB: #19604
Reviewed by : Jimmy.Yang@oracle.com
2018-07-30 15:18:51 +03:00
Marko Mäkelä
91181b225c Merge 5.5 into 10.0 2018-07-30 15:09:25 +03:00
Marko Mäkelä
d17e9a02c4 Fix InnoDB/XtraDB warnings by GCC 8.2.0 2018-07-30 14:05:24 +03:00
Marko Mäkelä
8bdd125067 MDEV-16851 On schema mismatch in IMPORT TABLESPACE, display ROW_FORMAT in clear text
This is motivated by Oracle MySQL Bug #27542720 SCHEMA MISMATCH
- TABLE FLAGS DON'T MATCH, BUT FLAGS ARE NUMBERS
but using a different approach.

row_import::match_schema(): In case of a mismatch, display the
ROW_FORMAT and optionally KEY_BLOCK_SIZE of the .cfg file.
2018-07-30 13:13:43 +03:00
Marko Mäkelä
340963351c Use a more precise argument for memset() 2018-07-30 10:39:42 +03:00
Oleksandr Byelkin
fceda2dab6 Merge remote-tracking branch 'mysql/5.5' into 5.5
We do not accept:
1. We did not have this problem (fixed earlier and better)
 d982e717ab Bug#27510150: MYSQLDUMP FAILS FOR SPECIFIC --WHERE CLAUSES
2. We do not have such options (an DBUG_ASSERT put just in case)
 bbc2e37fe4 Bug#27759871: BACKRONYM ISSUE IS STILL IN MYSQL 5.7
3. Serg fixed it in other way in this release:
 e48d775c6f Bug#27980823: HEAP OVERFLOW VULNERABILITIES IN MYSQL CLIENT LIBRARY
2018-07-29 13:10:29 +02:00
Sergei Golubchik
0b3e28a4cd MDEV-8941 Compile on Solaris (SPARC) fails with errors in filamvct.cpp
remove unnecessary declaration
2018-07-19 11:35:38 +02:00
Vladislav Vaintroub
a2c0376e08 Fix build on non-Windows, broken by 0897a25c0f 2018-07-02 17:45:19 +01:00
Vladislav Vaintroub
0897a25c0f MDEV-16596 : Windows - redo log does not work on native 4K sector disks.
Disks with native 4K sectors need 4K alignment and size for  unbuffered IO
(i.e for files opened with FILE_FLAG_NO_BUFFERING)

Innodb opens redo log with FILE_FLAG_NO_BUFFERING, however it always does
512byte IOs. Thus, the IO on 4K native sectors will fail, rendering
Innodb non-functional.

The fix is to check whether OS_FILE_LOG_BLOCK_SIZE is multiple of logical
sector size, and if it is not, reopen the redo log without
FILE_FLAG_NO_BUFFERING flag.
2018-07-02 15:02:31 +01:00
Eugene Kosov
ff8b3c8df8 MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
ha_innobase::prepare_inplace_alter_table: preserve DATA DICTIONARY for table
2018-06-26 11:11:15 +03:00
Alexander Barkov
6c08ff3eb7 Merge remote-tracking branch 'origin/5.5' into 10.0 2018-06-20 16:55:24 +04:00
Alexander Barkov
170b43c156 MDEV-16534 PPC64: Unexpected error with a negative value into auto-increment columns in HEAP, MyISAM, ARIA 2018-06-20 16:36:46 +04:00
Alexander Barkov
c450f7d8d5 Merge remote-tracking branch 'origin/5.5' into 10.0 2018-06-19 14:03:41 +04:00
Vicențiu Ciorbaru
170bec36c0 Merge branch '5.5' into 10.0 2018-06-12 17:59:31 +03:00
Marko Mäkelä
0ad9c3a016 MDEV-16456 InnoDB error "returned OS error 71" complains about wrong path
When attempting to rename a table to a non-existing database,
InnoDB would misleadingly report "OS error 71" when in fact the
error code is InnoDB's own (OS_FILE_NOT_FOUND), and not report
both pathnames. Errors on rename could occur due to reasons
connected to either pathname.

os_file_handle_rename_error(): New function, to report errors in
renaming files.
2018-06-12 09:54:31 +03:00
Oleksandr Byelkin
e425216045 MDEV-15113: Hang in Aria loghandler
Added unregistering writers in case of log error.
Added more debugging control about adding/removing writers to the buffers.
2018-06-12 07:08:39 +02:00
Sergei Golubchik
e7ca377cb7 MDEV-16342 SHOW ENGINES: MyISAM description is useless
rewrite tautological engine descriptions
2018-06-11 09:57:54 +02:00
Vicențiu Ciorbaru
24d7cbe1e0 Ensure TokuDB compiles both on Linux and OS X
On OS X, (u)int64_t is defined as (unsigned) long long int while on 74
bit Linux it is defined as (unsigned) long int.

Ensure the type matches when doing printf on all systems.
2018-06-11 00:18:12 +03:00
Vicențiu Ciorbaru
e5a3d24b87 Followup for make TokuDB compile with GCC-8
Missed printfs from: 21246066b2
2018-06-10 21:45:05 +03:00
Vicențiu Ciorbaru
3ead951180 Merge branch '5.5' into 10.0 2018-06-10 17:16:27 +03:00
Teodor Mircea Ionita
953d70f960 MDEV-15778: Remove packed attr from omt_ and subtree_ classes
Undo the revert that happened by mystake in commit 7fca4b50ff.
2018-06-10 16:39:30 +03:00
Vicențiu Ciorbaru
21246066b2 Make TokuDB compile with GCC-8
GCC-8 introduced multiple warnings and increased the level of
strictness.

* -Wshadow will warn if a local variable shadows a typedef.
* GCC will also warn when memsetting a non-trivial type.
  In this case a non-trivial type can not have a custom constructor.
  For all intents and purposes, the class is trivially-copyable.
* GCC will also warn if you use too many paranthesses which are not
necessary
2018-06-10 15:56:30 +03:00
Vicențiu Ciorbaru
7fca4b50ff Revert "MDEV-15778: Remove packed attr from omt_ and subtree_ classes"
This reverts commit 1735fa340a.
2018-06-10 15:20:43 +03:00
Teodor Mircea Ionita
7053e26e18 MDEV-15778: Fix TokuDB build issues on macOS 10.13.4
Several issues were encountered and fixed as explained bellow:

* missing link to dbug lib;
* user proper fprintf format specifier;
* ZERO_COND_INITIALIZER was using wrong toku_cond_t struct
  initializer for first member of type pthread_cond_t and
  not considering the TOKU_PTHREAD_DEBUG case which has
  one extra struct member of type pfs_key_t;
* Remove likely(!opt_debug_sync_timeout), argument is
  declared extern and not available to Toku;
* pthread_mutex_timedlock() is not available in pthreads
  for Mac, as it's not part of the POSIX pthreads spec.
  The encompassing event_t::wait(ms) methods are unused,
  thus have been removed;
2018-06-10 10:12:34 +03:00
Teodor Mircea Ionita
8f82c48443 MDEV-15778: Restore file permissions lost in merge
Permissions were probably due to a file copy in:
15f7f5c6bb Merge branch 'merge-tokudb-5.6' into 10.0
2018-06-10 10:12:34 +03:00
Teodor Mircea Ionita
1735fa340a MDEV-15778: Remove packed attr from omt_ and subtree_ classes
This is happening because they are declared as packed
and clang has -Waddress-of-packed-member when passing the
address of a packed member, a legit concern on different
architectures. The easiest way to get rid of the errors is to
remove the packed attribute from said structs.
2018-06-10 09:54:00 +03:00
Teodor Mircea Ionita
b8e267c0c5 MDEV-15778: Manually backport TokuDB macOS fixes from 10.0
Fix build on macOS 10.13:

39dceaae60 MDEV-10983: TokuDB does not compile on OS X 10.12
Make use of a different function to get the current tid.
Additionally, librt doesn't exist on OS X. Use System library instead.

 storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake | 4 +++-
 storage/tokudb/PerconaFT/portability/portability.cc               | 9 ++++++++-
 storage/tokudb/PerconaFT/portability/tests/test-xid.cc            | 9 ++++++++-
 storage/tokudb/PerconaFT/portability/toku_config.h.in             | 1 +
 4 files changed, 20 insertions(+), 3 deletions(-)
2018-06-10 09:54:00 +03:00
Marko Mäkelä
55abcfa7b7 MDEV-16124 fil_rename_tablespace() times out and crashes server during table-rebuilding ALTER TABLE
InnoDB insisted on closing the file handle before renaming a file.
Renaming a file should never be a problem on POSIX systems. Also on
Windows it should work if the file was opened in FILE_SHARE_DELETE
mode.

fil_space_t::stop_ios: Remove. We no longer need to stop file access
during rename operations.

fil_mutex_enter_and_prepare_for_io(): Remove the wait for stop_ios.

fil_rename_tablespace(): Remove the retry logic; do not close the
file handle. Remove the unused fault injection that was added along
with the DATA DIRECTORY functionality (MySQL WL#5980).

os_file_create_simple_func(), os_file_create_func(),
os_file_create_simple_no_error_handling_func(): Include FILE_SHARE_DELETE
in the share_mode. (We will still prevent multiple InnoDB instances
from using the same files by not setting FILE_SHARE_WRITE.)
2018-06-05 18:16:12 +03:00
Marko Mäkelä
a61724a3ca MDEV-16267 Wrong INFORMATION_SCHEMA.INNODB_BUFFER_PAGE.TABLE_NAME
i_s_innodb_buffer_page_fill(), i_s_innodb_buf_page_lru_fill():
Only invoke Field::set_notnull() if the index was found.
2018-05-24 11:38:34 +03:00
Monty
2f3779d31c Fixes for Aria transaction handling with lock tables
MDEV-10130 Assertion `share->in_trans == 0' failed in storage/maria/ma_close.c
MDEV-10378 Assertion `trn' failed in virtual int ha_maria::start_stmt

The problem was that maria_handler->trn was not properly reset
at commit/rollback and ha_maria::exernal_lock() could get confused
because.

There was some old code in ha_maria::implicit_commit() that tried
to take care of this, but it was not bullet proof.

Fixed by adding list of all tables that is part of the maria transaction to
TRN.

A nice side effect was of the fix is that loops in
ha_maria::implict_commit() got to be much simpler.

Other things:
- Fixed a bug in mysql_admin_table() where argument open_for_modify
  was wrongly reset for the next table in the chain
- rollback admin command also in case of fatal error.
- Split _ma_set_trn_for_table() to three version to simplify code
  and debugging.
- Several new asserts to detect the original problem (that file was
  not properly removed from trn before calling ma_close())
2018-05-22 23:05:48 +03:00
Arun Kuruvila
bd5ca6acec Bug#25541037: MYSQL BUG ON DELETE
Description:- MyISAM table gets corrupted with concurrent
executions of INSERT, DELETE statements in a particular
sequence.

Analysis:- Due to the inappropriate manipulation of w_lock
and r_lock associated with a MyISAM table, there arises a
scenario where the table's state information becomes
invalid.

Fix:- A lock is introduced to resolve this issue.
2018-05-21 08:42:45 +05:30
Sergei Golubchik
c1b5d2801e Merge branch '5.5' into 10.0 2018-05-19 15:38:34 +02:00