Commit graph

180832 commits

Author SHA1 Message Date
Olivier Bertrand
9644415fa9 - Fix MDEV-16672 Connect: Warnings with 10.0
filamtxt.cpp: DOSFAM::RenameTempFile: Change sprintf to snprintf.
  filamvct.cpp: VECFAM::RenameTempFile: Change sprintf to snprintf.
  javaconn.cpp:
    Add JAVAConn::GetUTFString function.
    Use it instead of env->GetStringUTFChars.
    Fix wrong identation.
  javaconn.h: Add GetUTFString declaration.
  jdbconn.cpp:
    Use GetUTFString function instead of env->GetStringUTFChars.
  jmgoconn.cpp:
    Use GetUTFString function instead of env->GetStringUTFChars.
    Fix wrong identation.
  jsonudf.cpp: change 139 to BMX line 4631.
  tabjmg.cpp:
    Add ReleaseStringUTF.
    Fix wrong identation.
  tabpivot.cpp: Fix wrong identation.
  tabutil.cpp: TDBPRX::GetSubTable: Change sprintf to snprintf.
  modified:   storage/connect/filamtxt.cpp
  modified:   storage/connect/filamvct.cpp
  modified:   storage/connect/javaconn.cpp
  modified:   storage/connect/javaconn.h
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/jmgoconn.cpp
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/tabjmg.cpp
  modified:   storage/connect/tabpivot.cpp
  modified:   storage/connect/tabutil.cpp

- Fix MDEV-16895 CONNECT engine's get_error_message can cause buffer
                 overflow and server crash with long queries
  ha_connect_cc: Update version.
    get_error_message: Remove charset conversion.
  modified:   storage/connect/ha_connect.cc

- Fix a server crash on inserting bigint to a JDBC table
  JDBConn::SetUUID:
    Suppress check on ctyp that causes a server crash because ctyp
    can be negative and this triggers an DEBUG_ASSERT on return.
  modified:   storage/connect/jdbconn.cpp

- Update jdbc.result
  mysql-test/connect/r/jdbc.result: Recorded to reflect a message change.
  modified:   storage/connect/mysql-test/connect/r/jdbc.result
2018-08-06 19:42:00 +02:00
Rasmus Johansson
ebaacf0747
Update rules 2018-08-06 16:46:19 +03:00
Jan Lindström
3b37edee1a MDEV-13333: Deadlock failure that does not occur elsewhere
InnoDB executed code that is mean to execute only when Galera
is used and in bad luck one of the transactions is selected
incorrectly as deadlock victim. Fixed by adding wsrep_on_trx()
condition before entering actual Galera transaction handling.

No always repeatable test case for this issue is known.
2018-08-06 15:45:44 +03:00
Alexey Botchkov
4ddcb4eb46 MDEV-16750 JSON_SET mishandles unicode every second pair of arguments.
The charset of temporary storage (Item_func_json_insert::tmp_js)
  was not properly set.
2018-08-06 13:37:09 +04:00
Jan Lindström
998b1c0e75 Fix galera test MW-44 2018-08-05 18:16:26 +03:00
Alexey Botchkov
fc324a5f87 MDEV-16869 String functions don't respect character set of JSON_VALUE.
Item_func_json_value::val_str() produced string of wrong charset.
2018-08-05 18:33:17 +04:00
Varun Gupta
9419908f38 MDEV-15433: Optimizer does not use group by optimization with distinct
After the commit b76b69cd5f
loose index scan for queries with DISTINCT stopped working.
That is why that commit has to be reverted.
Additionally this patch  fixes the problem of MDEV-10880.
2018-08-05 13:25:40 +03:00
Jan Lindström
b9f0112248
Merge pull request #609 from benrubson/stunnel
MDEV-15511 - Use stunnel during rsync SST if available
2018-08-05 09:27:13 +03:00
Vladislav Vaintroub
50c4262002 MDEV-16544 - crash in ha_sphinx::create()
Use table_arg that was passed to the function, instead of dereferencing
this->table, which is a NULL pointer.
2018-08-04 22:53:16 +01:00
Jan Lindström
5d90717cc9 Add wsrep.cnf 2018-08-04 11:28:25 +03:00
Elena Stepanova
1e37fa70bd Updated list of unstable tests for 10.1.35 release 2018-08-04 03:06:27 +03:00
Oleksandr Byelkin
affdd79c69 Merge branch '10.1' into 10.2 2018-08-03 23:26:26 +02:00
sachin
68ebfb31f2 MDEV-16166 RBR breaks with HA_ERR_KEY_NOT_FOUND upon DELETE from table...
with spatial index

So the issue is since it is spatial index , at the time of searching index
for key (Rows_log_event::find_row) we use wrong field image we use
Field::itRAW while we should be using Field::itMBR
2018-08-04 01:39:35 +05:30
Jan Lindström
ea0356e1ad Add galera library dependency directly to test case. 2018-08-03 16:43:32 +03:00
Marko Mäkelä
e6a808bec7 Fix heap-use-after-free in debug code
rw_lock_get_debug_info(): Remove. This function is inherently unsafe
to use, because the copied pointers can become stale between
rw_lock_debug_mutex_exit() and the dereferencing of the pointer in
the caller.
2018-08-03 15:40:13 +03:00
Oleksandr Byelkin
701f0b8e36 Fix gcc 7.3 compiler warnings. 2018-08-03 14:37:55 +02:00
Marko Mäkelä
be370efac4 Do not declare an unused variable 2018-08-03 14:37:31 +03:00
Jan Lindström
9808e23a7a MariaDB adjustments. 2018-08-03 13:44:30 +03:00
Marko Mäkelä
7b145fae13 mariabackup: Use snprintf() instead of sprintf() 2018-08-03 13:06:35 +03:00
Marko Mäkelä
391e60b2db Fix -Wclass-memaccess warnings in InnoDB 2018-08-03 13:06:03 +03:00
Marko Mäkelä
814ae57daf Merge 10.1 into 10.2 2018-08-03 13:02:56 +03:00
Vasil Dimov
3f0cd66a2b Also include InnoDB undo tablespaces in rsync sst
If --innodb-undo-tablespaces is used, then InnoDB stores undo in a
separate file(s) which whould also be replicated.

This fixes
Issue#337 This filter will cause sst failed at applying undo...
https://github.com/codership/mysql-wsrep/issues/337
2018-08-03 12:31:57 +03:00
Vasil Dimov
62e290923e Put one filter per line in wsrep_sst_rsync.sh
This way it is more readable and easy to change, also if a new entry is
added or one removed, the diff will be easier to read.
2018-08-03 12:31:25 +03:00
Oleksandr Byelkin
9d42eb5e28 Disable an unstable test 2018-08-03 12:30:50 +03:00
Marko Mäkelä
769f6d2db7 Fix -Wclass-memaccess in WSREP,InnoDB,XtraDB 2018-08-03 12:21:13 +03:00
mkaruza
639bd1c71f galera#505 mtr test
MTR test for galera#505
2018-08-03 12:16:36 +03:00
Teemu Ollakka
1d414d9491 codership/galera#501 Check cluster weight in galera_pc_weight test
Check that cluster weight have proper values in galera_pc_weight
test. Removed sleeps from tests and added condition waits for
expected cluster sizes. Replaced galera suspend/resume with
gmcast.isolate in order to avoid breaking client connections
to server which is isolated from the cluster and to avoid
the need to reset wsrep_cluster_address.

Re-recorded galera_defaults.
2018-08-03 12:05:14 +03:00
Marko Mäkelä
0d3972c6be Merge 10.0 into 10.1 2018-08-03 12:03:10 +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ä
976f920514 MDEV-16850 Merge new release of InnoDB 5.7.23 to 10.2
This concludes the merge of all applicable InnoDB changes from
MySQL 5.7.23, with the exception of a performance fix, which we
plan to rewrite in MariaDB later in such a way that it does not
involve changing the storage engine API:

MDEV-16849 Extending indexed VARCHAR column should be instantaneous
2018-08-03 08:37:05 +03:00
Marko Mäkelä
62ee2cd461 Fix a race between TRUNCATE and FOREIGN KEY check
This is a port of an Oracle fix.

No test case was provided by Oracle. It seems that to exploit this
bug, one would have to SET foreign_key_checks=0 before TRUNCATE,
and to concurrently run some DML statement that causes a foreign key
constraint to be checked.

commit 1f24c5aa2843fa548aa5c4b29c00f955e03e9f5b
Author: Aditya A <aditya.a@oracle.com>
Date:   Fri May 18 12:32:37 2018 +0530

    Bug #27208858 CONCURRENT DDL/DML ON FOREIGN KEYS CRASH IN
    PAGE_CUR_SEARCH_WITH_MATCH_BYTES
2018-08-03 08:33:38 +03:00
Marko Mäkelä
de469a2f29 MDEV-14637: Fix hang due to persistent statistics
Similar to the tables SYS_FOREIGN and SYS_FOREIGN_COLS,
the tables mysql.innodb_table_stats and mysql.innodb_index_stats
are updated by the InnoDB internal SQL parser, which fails to
enforce the size limits of the data. Due to this, it is possible
for InnoDB to hang when there are persistent statistics defined on
partitioned tables where the total length of table name,
partition name and subpartition name exceeds the incorrectly
defined limit VARCHAR(64). That column should have been defined
as VARCHAR(199).

btr_node_ptr_max_size(): Interpret the VARCHAR(64) as VARCHAR(199),
to prevent a hang in the case that the upgrade script has not been
run.

dict_table_schema_check(): Ignore difference in the length of the
table_name column.

ha_innobase::max_supported_key_length(): For innodb_page_size=4k,
return a larger value so that the table mysql.innodb_index_stats
can be created. This could allow "impossible" tables to be created,
such that it is not possible to insert anything into a secondary
index when both the secondary key and the primary key are long,
but this is the easiest and most consistent way. The Oracle fix
would only ignore the maximum length violation for the two
statistics tables.

os_file_get_status_posix(), os_file_get_status_win32(): Handle
ENAMETOOLONG as well.

This patch is based on the following change in MySQL 5.7.23.
Not all changes were applied, and our variant allows persistent
statistics to work without hangs even if the table definitions
were not upgraded.

From fdbdce701ab8145ae234c9d401109dff4e4106cb Mon Sep 17 00:00:00 2001
From: Aditya A <aditya.a@oracle.com>
Date: Thu, 17 May 2018 16:11:43 +0530
Subject: [PATCH] Bug #26390736 THE FIELD TABLE_NAME (VARCHAR(64)) FROM
           MYSQL.INNODB_TABLE_STATS CAN OVERFLOW.

    In mysql.innodb_index_stats and mysql.innodb_table_stats
    tables the table name column didn't take into consideration
    partition names which can be more than varchar(64).
2018-08-03 08:33:38 +03:00
Marko Mäkelä
2046089745 MDEV-14637: Fix hang due to DDL with FOREIGN KEY
When MySQL 5.7.1 introduced WL#6326 to reduce contention on the
non-leaf levels of B-trees, it introduced a new rw-lock mode SX
(not conflicting with S, but conflicting with SX and X) and
new rules to go with it.

A thread that is holding an dict_index_t::lock aka index->lock
in SX mode is permitted to acquire non-leaf buf_block_t::lock
aka block->lock X or SX mode, in monotonically descending order.
That is, once the thread has acquired a block->lock, it is not
allowed to acquire a lock on its parent or grandparent pages.
Such arbitrary-order access is only allowed when the thread
acquired the index->lock in X mode upfront.

A customer encountered a repeatable hang when loading a dump into
InnoDB while using multiple innodb_purge_threads (default: 4).
The dump makes very heavy use of FOREIGN KEY constraints.
By luck, it happened so that two purge worker threads (srv_worker_thread)
deadlocked with each other. Both were operating on the index FOR_REF
of the InnoDB internal table SYS_FOREIGN. One of them was legitimately
holding index->lock S-latch and the root block->lock S-latch. The other
had acquired index->lock SX-latch, root block->lock SX-latch, and a bunch
of other latches, including the fil_space_t::latch for freeing some blocks
and some leaf page latches. This other thread was inside 2 nested calls
to btr_compress() and it was trying to reacquire the root block->lock
in X mode, violating the WL#6326 protocol.

This violation led to a deadlock, because while S is compatible with SX
and a thread can upgrade an SX lock to X when there are no conflicting
requests, in this case there was a conflicting S lock held by the other
purge worker thread.

During this deadlock, both threads are holding dict_operation_lock S-latch,
which would block any subsequent DDL statements, such as CREATE TABLE.

The tables SYS_FOREIGN and SYS_FOREIGN_COLS are special in that they
define key columns of the type VARCHAR(0), created using the InnoDB
internal SQL parser. Because InnoDB does not internally enforce the
maximum length of columns, it would happily write more than 0 bytes
to these columns. This caused a miscalculation of node_ptr_max_size.

btr_cur_will_modify_tree(): Clean up some code. (No functional change.)

btr_node_ptr_max_size(): Renamed from dict_index_node_ptr_max_size().
Use a more realistic maximum size for SYS_FOREIGN and SYS_FOREIGN_COLS.

btr_cur_pessimistic_delete(): Refrain from merging pages if it is
not safe.

This work is based on the following MySQL 5.7.23 fix:

commit 58dcf0b4a4165ed59de94a9a1e7d8c954f733726
Author: Aakanksha Verma <aakanksha.verma@oracle.com>
Date:   Wed May 9 18:54:03 2018 +0530

    BUG#26225783 MYSQL CRASH ON CREATE TABLE (REPRODUCEABLE) -> INNODB: A
    LONG SEMAPHORE WAIT
2018-08-03 08:32:17 +03:00
Allen Lai
f70a318576 Bug#27805553 HARD ERROR SHOULD BE REPORTED WHEN FSYNC() RETURN EIO.
fsync() will just return EIO only once when the IO error happens, so, it's
wrong to keep trying to call it till it return success.
When fsync() returns EIO it should be treated as a hard error and InnoDB must
abort immediately.
2018-08-03 08:32:17 +03:00
Sergey Vojtovich
a1b2336199 Optimized away excessive condition
trx_set_rw_mode() is never called for read-only transactions, this is guarded
by callers.

Removing this condition from critical section immediately gives 5% scalability
improvement in OLTP index updates benchmark.
2018-08-03 08:32:17 +03:00
Marko Mäkelä
f867a695f8 After-merge fix: Remove an unnecessary parameter 2018-08-03 08:32:11 +03:00
Oleksandr Byelkin
5ce21bc67f Merge branch '10.1' into 10.2 2018-08-02 21:41:41 +02:00
Oleksandr Byelkin
b4f7f12e2b fix galera test. 2018-08-02 20:27:10 +02:00
Jan Lindström
40f6bcb856 Add missing WSREP(thd) condition and remove unnecessary DBUG_RETURN. 2018-08-02 20:35:44 +03:00
Eugene Kosov
1a7a018939 MDEV-16557 Remove INNOBASE_SHARE::idx_trans_tbl
INNOBASE_SHARE: remove

check_index_consistency(): iterates through keys and looks for InnoDB and .frm
mismatches.

ha_innobase::innobase_get_index(): now uses dict_table_get_index_on_name()

dict_table_get_index_on_name(): uses strcmp() instead of innobase_casestrcmp()
as we just need to know whether strings are equal or not
2018-08-02 18:05:59 +03:00
Jan Lindström
9b29bda0d6 Merge remote-tracking branch 'origin/5.5-galera' into 10.0-galera 2018-08-02 13:13:21 +03:00
Jan Lindström
c5a8583b31 Merge tag 'mariadb-10.0.36' into 10.0-galera 2018-08-02 11:44:02 +03:00
Daniele Sciascia
e88e26b424 Follow up to previous commit for codership/mysql-wsrep#332
Fix misplaced `DBUG_RETURN` in `Alter_table_statement::execute`.
2018-08-02 10:37:03 +03:00
Daniele Sciascia
4d2b552369 Fix FK constraint violation in applier, after ALTER TABLE ADD FK
Adding a FK constraint to an existing table (ALTER TABLE ADD FOREIGN
KEY) causes the applier to fail, if a concurrent DML statement that
violate the new constraint (i.e. a DELETE or UPDATE of record in the
parent table).

For exmaple, the following scenario causes a crash in the applier:

1. ALTER successfully adds FK constraint in node_1
2. On node_2 is UPDATE is in pre_commit() and has certified successfully
3. ALTER is delivered in node_2 and BF aborts DML
4. Applying UPDATE event causes FK violation in node_1

To avoid this situation it is necessary for UPDATE to fail during
certification. And for the UPDATE to fail certfication it is necessary
that ALTER appends certification keys for both the child and the parent
table. Before this patch, ALTER TABLE ADD FK only appended keys for
child table which is ALTERed.
2018-08-02 09:03:27 +03:00
Marko Mäkelä
ef3070e997 Merge 10.1 into 10.2 2018-08-02 08:19:57 +03:00
Daniel Bartholomew
90b66c1699 bump the VERSION 2018-08-01 12:09:33 -04:00
Vladislav Vaintroub
a90b3862d9 MDEV-16860 MyRocks: support CRC32 instructions on Winx64
Compile on Windows MSVC with -DHAVE_SSE2 and -DHAVE_PCLMUL

It is safe, since code will do also runtime checks via cpuid(), before
using the instructions, and will fallback to slower versions,
if instructions are not available.
2018-08-01 12:41:50 +01:00
Jan Lindström
b286a9f823 Merge tag 'mariadb-5.5.61' into 5.5-galera 2018-08-01 10:58:38 +03:00
Marko Mäkelä
2fb68244b4 Merge 10.0 into 10.1 2018-08-01 08:45:59 +03:00