Commit graph

172084 commits

Author SHA1 Message Date
Sergei Golubchik
a3cf69e2e5 MDEV-10936 CONNECT engine JDBC type can't find JdbcInterface
Don't use instal_jar() from Use_Java.cmake -
at least in CentOS 7 (cmake 2.8.12.2) it doesn't yet support
the COMPONENT option.
2017-05-15 22:23:11 +02:00
Sergei Golubchik
a8773ef380 MDEV-12660 inconsistent mysql_stmt_close
remove dead code: this "return rc" could've never happened,
because reset_stmt_handle can only possibly fail if RESET_SERVER
flag is used.

But this "return rc" was confusing, it was under DBUG_ENTER (while
not being DBUG_RETURN) and it was skipping required stmt cleanup
at the end of the function.
2017-05-15 22:23:11 +02:00
Sergei Golubchik
a65623b3eb MDEV-11883 MariaDB crashes with out-of-memory when query information_schema
CSV engine didn't expect CSM files to be read-only
2017-05-15 22:23:10 +02:00
Sergei Golubchik
71b4503242 MDEV-9998 Fix issues caught by Clang's -Wpointer-bool-conversion warning
remove useless checks
and a couple of others
2017-05-15 22:23:10 +02:00
Sergei Golubchik
f9264280d6 MDEV-12761 Error return from external_lock make the server crash
bunch of bugs when external_lock() fails on unlock:
* mi_lock_database() used mi_mark_crashed() under share->intern_lock,
  but mi_mark_crashed() itself locks this mutex.
* handler::close() required table to be unlocked, but failed
  external_lock didn't count as unlock
* mysql_unlock_tables() ignored all unlock errors, but they still set
  the error status in stmt_da.
2017-05-15 22:23:10 +02:00
Sergei Golubchik
52aa200919 MDEV-12420 max_recursive_iterations did not prevent a stack-overflow and segfault
post-review fixes
* move pcre-specific variable out of mysys
* don't use current_thd
* move a commonly used macro to my_sys.h
* remove new sysvar
2017-05-15 22:23:10 +02:00
Daniel Black
602b5e4c49 WIP: global readonly variable pcre_frame_size 2017-05-15 22:23:10 +02:00
Daniel Black
b30311e52a MDEV-12420: pcre recursion overflow test case 2017-05-15 22:23:10 +02:00
Daniel Black
fbc057ad36 MDEV-12420: add full list of pcre error messages 2017-05-15 22:23:10 +02:00
Daniel Black
d672f88ef7 MDEV-12420: PCRE stack overflow
It was possible to construct a PCRE expression that exceeded the stack.
resulting in a crash:

With fix:

MariaDB [(none)]> SELECT 1
    -> FROM dual
    -> WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp'
    ->
    -> REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
Empty set, 1 warning (0.00 sec)

MariaDB [(none)]> show warnings;
+---------+------+---------------------------------------------------------+
| Level   | Code | Message                                                 |
+---------+------+---------------------------------------------------------+
| Warning | 1139 | Got error 'pcre_exec: Internal error (-21)' from regexp |
+---------+------+---------------------------------------------------------+
2017-05-15 22:23:10 +02:00
Marko Mäkelä
217b8115c8 MDEV-12188 information schema - errors populating fail to free memory, unlock mutexes
Given the OK macro used in innodb does a DBUG_RETURN(1) on expression failure
the innodb implementation has a number of errors in i_s.cc.

We introduce a new macro BREAK_IF that replaces some use of the OK macro.
Also, do some other cleanup detailed below.

When invoking Field::store() on integers, always pass the parameter
is_unsigned=true to avoid an unnecessary conversion to double.

i_s_fts_deleted_generic_fill(), i_s_fts_config_fill():
Use the BREAK_IF macro instead of OK.

i_s_fts_index_cache_fill_one_index(), i_s_fts_index_table_fill_one_index():
Add a parameter for conv_string, and let the caller allocate that buffer.

i_s_fts_index_cache_fill(): Check the return status of
i_s_fts_index_cache_fill_one_index().

i_s_fts_index_table_fill(): Check the return status of
i_s_fts_index_table_fill_one_index().

i_s_fts_index_table_fill_one_fetch(): Always let the caller invoke
i_s_fts_index_table_free_one_fetch().

i_s_innodb_buffer_page_fill(), i_s_innodb_buf_page_lru_fill():
Do release dict_sys->mutex if filling the buffers fails.

i_s_innodb_buf_page_lru_fill(): Also display the value
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE.PAGE_IO_FIX='IO_PIN'
when a block is in that state. Remove the unnecessary variable 'heap'.
2017-05-15 18:02:16 +03:00
Marko Mäkelä
8417252b04 Fix the Solaris compilation after MDEV-12674
simple_counter::add(): Add a type cast to the os_atomic_increment_ulint()
call, because GCC would check the type compatibility even when the code
branch is not being instantiated (atomic=false). On Solaris,
os_atomic_increment_ulint() actually needs a compatible parameter type,
and an error would be emitted due to an incompatible 64-bit type,
for srv_stats.n_lock_wait_time.add(diff_time).
2017-05-15 10:26:42 +03:00
Marko Mäkelä
ff16609374 MDEV-12674 Innodb_row_lock_current_waits has overflow
There is a race condition related to the variable
srv_stats.n_lock_wait_current_count, which is only
incremented and decremented by the function lock_wait_suspend_thread(),

The incrementing is protected by lock_sys->wait_mutex, but the
decrementing does not appear to be protected by anything.
This mismatch could allow the counter to be corrupted when a
transactional InnoDB table or record lock wait is terminating
roughly at the same time with the start of a wait on a
(possibly different) lock.

ib_counter_t: Remove some unused methods. Prevent instantiation for N=1.
Add an inc() method that takes a slot index as a parameter.

single_indexer_t: Remove.

simple_counter<typename Type, bool atomic=false>: A new counter wrapper.
Optionally use atomic memory operations for modifying the counter.
Aligned to the cache line size.

lsn_ctr_1_t, ulint_ctr_1_t, int64_ctr_1_t: Define as simple_counter<Type>.
These counters are either only incremented (and we do not care about
losing some increment operations), or the increment/decrement operations
are protected by some mutex.

srv_stats_t::os_log_pending_writes: Document that the number is protected
by log_sys->mutex.

srv_stats_t::n_lock_wait_current_count: Use simple_counter<ulint, true>,
that is, atomic inc() and dec() operations.

lock_wait_suspend_thread(): Release the mutexes before incrementing
the counters. Avoid acquiring the lock mutex if the lock wait has
already been resolved. Atomically increment and decrement
srv_stats.n_lock_wait_current_count.

row_insert_for_mysql(), row_update_for_mysql(),
row_update_cascade_for_mysql(): Use the inc() method with the trx->id
as the slot index. This is a non-functional change, just using
inc() instead of add(1).

buf_LRU_get_free_block(): Replace the method add(index, n) with inc().
There is no slot index in the simple_counter.
2017-05-12 12:24:53 +03:00
Sergei Golubchik
1c418df722 Merge branch '5.5' into 10.0 2017-05-08 12:12:48 +02:00
Monty
fc25437aff MDEV-10104 Table lock race condition with replication
Problem was two race condtion in Aria page cache:
- find_block() didn't inform free_block() that it had released requests
- free_block() didn't handle pinned blocks, which could happen if
  free_block() was called as part of flush. This is fixed by not freeing
  blocks that are pinned.  This is safe as when maria_close() is called
  when last thread is using a table, there can be no pinned blocks. For
  other flush calls it's safe to ignore pinned blocks.
2017-05-05 18:25:35 +03:00
Monty
e3521ab904 Fixed some bugs in fork_big.pl which caused some tests to die early
- Changed to 'strict'
- Fixed scope of variables
- Made timing smaller for of repair, check, flush and alter to get them to
  trigger earlier
2017-05-05 18:25:35 +03:00
Marko Mäkelä
bc5c1d9970 MDEV-12635 innodb.log_file_size fails when run with Valgrind
In MariaDB Server before 10.2, InnoDB will not be shut down properly
if startup fails. So, Valgrind failures are to be expected.
Disable the test under Valgrind. In 10.2, it should pass with Valgrind.
2017-05-05 14:04:18 +03:00
Igor Babaev
15f9931f6d Fixed the bug mdev-12673.
This patch corrects the fix for the bug mdev-10693.
It is critical for the function get_best_combination() not to call
create_ref_for_key() for constant tables.
This bug could manifest itself only in multi-table subqueries where
one of the tables is accessed by a constant primary key.
2017-05-04 22:45:32 -07:00
Sergei Golubchik
a7c5fd6b4e restore dependencies, removed in f2dc04abea
otherwise make didn't know it needs to regenerate lex_hash.h
when gen_lex_hash (that is sql_yacc.h, that is sql_yacc.yy) changes.
2017-05-03 15:49:19 +02:00
Daniel Bartholomew
14fca28ea4 bump the VERSION 2017-05-02 19:11:21 -04:00
Daniel Black
dbe2c3c5f2 mysqld_safe_help - remove warning
/home/travis/build/MariaDB/server/extra/mysqld_safe_helper.c:62:21: warning: too many arguments in call to 'do_usage'
    do_usage(argv[0]);
    ~~~~~~~~        ^
1 warning generated.
2017-04-30 15:06:01 +04:00
Oleksandr Byelkin
49552cf1f7 Merge branch '5.5' into bb-10.0-merge-5.5 2017-04-25 16:30:39 +02:00
Igor Babaev
2e7ba70a94 Fixed the bug mdev-10693.
The code that chooses between materialization of a non-correlated
IN subquery and its transformation into an EXISTS correlated
subquery assumes that the execution plan for the outer select
has been already built. However it was not always so if subqueries
occurred in the expressions used for ref access to tables of
the outer select. A call of the function create_ref_for_key() in
get_best_combination() could trigger a premature execution of
the above mentioned code when the execution plan structures for
the outer select were not fully built. This could cause a crash
of the server.

The fix postpones the calls of create_ref_for_key() until the
structures for the execution plan is fully built.
2017-04-24 11:46:01 -07:00
Marko Mäkelä
57fea99eeb Add and adjust a test from MySQL:
commit 1198267c331b045b9cad26be72b1a5b4f8930a79
Author: Thirunarayanan Balathandayuthapani <thirunarayanan.balathandayuth@oracle.com>
Date:   Fri Aug 26 11:00:44 2016 +0530

    Bug #20989615   INNODB AUTO_INCREMENT PRODUCES SAME VALUE TWICE

The code fix is already present.
2017-04-24 16:45:40 +03:00
Marko Mäkelä
864548c4ec Add and adjust a test from MySQL:
commit 12343617922cfd9c48ee84ad6ecf53068d822010
Author: Thirunarayanan Balathandayuthapani <thirunarayanan.balathandayuth@oracle.com>
Date:   Fri Jul 15 14:39:37 2016 +0530

    Bug #23475211   COMBINING ALTER OPERATIONS TRIGGERS TABLE REBUILD

The code fix is already present.
2017-04-24 13:40:36 +03:00
Alexander Barkov
fac2a7a85d MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression 2017-04-22 22:51:43 +04:00
Igor Babaev
97fb1f2679 Fixed bug mdev-10053.
The implementation of the walk method for the class Item_in_subselect
was missing. As a result the method never traversed the left operand
of any IN subquery predicate.

Item_exists_subselect::exists2in_processor() that performs the
Exist-To-In transformation calls the walk method to collect info
on outer references. As the walk method did not traverse the
left operands of the IN subqueries the outer references there
were not taken into account and some subqueries that were actually
correlated were marked as uncorrelated. It could lead to an
attempt of the materialization of such a subquery.

Also added a cleanup for some test cases merged from 5.5.
2017-04-21 14:34:24 -07:00
Sergei Golubchik
26ed68dcae fix "cmake -DWITH_PCRE=bundled"
after building with system
2017-04-21 18:34:30 +02:00
Sergei Golubchik
8d75a7533e Merge branch '5.5' into 10.0 2017-04-21 18:34:06 +02:00
Marko Mäkelä
e056d1f1ca Fix some InnoDB type mismatch
On 64-bit Windows, sizeof(ulint)!=sizeof(ulong).
2017-04-21 17:39:12 +03:00
Marko Mäkelä
e48ae21b0e Follow-up to MDEV-12534: Fix warnings on 32-bit systems 2017-04-21 16:22:46 +03:00
Marko Mäkelä
87b6df31c4 MDEV-12488 Remove type mismatch in InnoDB printf-like calls
This is a reduced version of an originally much larger patch.
We will keep the definition of the ulint, lint data types unchanged,
and we will not be replacing fprintf() calls with ib_logf().

On Windows, use the standard format strings instead of nonstandard
extensions.

This patch fixes some errors in format strings.
Most notably, an IMPORT TABLESPACE error message in InnoDB was
displaying the number of columns instead of the mismatching flags.
2017-04-21 12:06:29 +03:00
Sergei Golubchik
c6ee3fe9d4 respect client's desire to force ssl even when WITH_SSL=NO
of course, this combination can never succeed,
we must fail to connect here.
2017-04-20 16:36:23 +02:00
Sergei Golubchik
4fe65ca33a MDEV-12230 include/my_sys.h:600:43: error: unknown type name ‘PSI_file_key’" when -DWITHOUT_SERVER=1
cherry-pick 2c2bd8c155 (MDEV-12261 build failure without P_S) from 10.0
2017-04-20 16:36:23 +02:00
Sergei Golubchik
0001049be0 MDEV-12276 Missing DBUG_RETURN or DBUG_VOID_RETURN macro in function "do_exec" 2017-04-20 16:36:23 +02:00
Sergei Golubchik
036b689f18 MDEV-12310 openat(<directory>, ...O_EXEC) fails on Illumos / Solaris
it could be
* O_SEARCH on Illumos
* O_EXEC on FreeBSD
* O_PATH on Linux
ugh
2017-04-20 16:36:22 +02:00
Sergei Golubchik
786363e89b compiler warning
way-too-smart compilers don't like the "confusing indentation"
2017-04-20 16:36:22 +02:00
Kristian Nielsen
39f1917f46 Attempt to fix strange rpm dependency issue following prior patch 2017-04-20 16:36:22 +02:00
Marko Mäkelä
d34a67b067 MDEV-12534 Use atomic operations whenever available
Allow 64-bit atomic operations on 32-bit systems,
only relying on HAVE_ATOMIC_BUILTINS_64, disregarding
the width of the register file.

Define UNIV_WORD_SIZE correctly on all systems, including Windows.
In MariaDB 10.0 and 10.1, it was incorrectly defined as 4 on
64-bit Windows.

Define HAVE_ATOMIC_BUILTINS_64 on Windows
(64-bit atomics are available on both 32-bit and 64-bit Windows
platforms; the operations were unnecessarily disabled even on
64-bit Windows).

MONITOR_OS_PENDING_READS, MONITOR_OS_PENDING_WRITES: Enable by default.

os_file_n_pending_preads, os_file_n_pending_pwrites,
os_n_pending_reads, os_n_pending_writes: Remove.
Use the monitor counters instead.

os_file_count_mutex: Remove. On a system that does not support
64-bit atomics, monitor_mutex will be used instead.
2017-04-20 16:29:12 +03:00
Oleksandr Byelkin
d185f1d68b Fix use of require in mysql-test-run.
The motivation for this is that Perl is moving towards not having
current directory ./ in @INC by default. This is causing
mysql-test-run.pl to fail in latest Debian Unstable:

  https://lists.debian.org/debian-devel-announce/2016/08/msg00013.html

However, we have `use "lib"`, there is no need for current directory
in @INC, except for a gross hack. In mtr_cases.pm, there is a
`require "mtr_misc.pl"`, which hides mtr_misc.pl away in mtr_cases
namespace. And things only work because mysql-test-run.pl loads it
with a different name, `require "lib/mtr_misc.pl"`! (Perl will
`require` only once for each unique filename).

Fix this by only using `require` in main program, and referencing
functions with :: scope from other namespaces. For multi-use in
different namespaces, proper `use` modules should be used.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2017-04-19 14:30:52 +02:00
Daniel Bartholomew
d53b541389 bump the VERSION 2017-04-13 09:35:57 -04:00
Sergei Golubchik
663068c6ee Merge remote-tracking branch 'mysql/5.5' into 5.5 2017-04-11 10:18:04 -04:00
Kristian Nielsen
88613e1df6 MDEV-11201: gtid_ignore_duplicates incorrectly ignores statements when GTID replication is not enabled
When master_use_gtid=no, the IO thread loads the slave GTID state from
the master during connect. This races with the SQL thread when
gtid_ignore_duplicates=1. If an event is in the relay log from before
the new connect and has not been applied yet, moving the slave
position causes the SQL thread to think that event should be skipped
due to gtid_ignore_duplicates=1.

This patch simply disables gtid_ignore_duplicates when not using GTID,
which seems to be what one would expect.
2017-04-10 07:53:27 +02:00
Daniel Black
7dd6efeaab Don't use full path of libtool
This is to be friendly to our OSX users where
the libtool path is very different.

Ref:
* https://github.com/Homebrew/homebrew-core/blob/master/Formula/mariadb.rb#L44..L46
2017-04-09 15:12:11 -04:00
Igor Babaev
5c579482eb Adjusted test results after the fix for mdev-12429. 2017-04-07 16:25:02 -07:00
Oleksandr Byelkin
57a699b0a0 MDEV-8642: WHERE Clause not applied on View - Empty result set returned
An attempt to mark reference as dependent lead to transfering this property to
original view field and through it to other references of this field which
can't be dependent.
2017-04-05 20:46:19 +02:00
Marko Mäkelä
8e36216a06 Import two ALTER TABLE…ALGORITHM=INPLACE tests from MySQL 5.6.
Also, revert part of MDEV-7685 that added an InnoDB abort when
ALTER TABLE…ALGORITHM=INPLACE is reporting that it ran out of
file space.
2017-04-05 14:46:35 +03:00
Igor Babaev
b0395d8701 Fixed the bug mdev-12429 and its duplicates mdev-12145 and mdev-9886.
Also fixed a wrong result for a test case for mdev-7691
(the alternative one).
The test  cases for all these bug have materialized semi-joins used
inside dependent sub-queries.

The patch actually reverts the change inroduced by Monty in 2003.
It looks like this change is not valid anymore after the implementation
of semi-joins.
Adjusted output from EXPLAIN for many other test cases.
2017-04-04 10:04:52 -07:00
Vladislav Vaintroub
f2dc04abea Compiling, Windows . Avoid unnecessary rebuilds with MSVC.
To export symbols from the mysqld.exe, use lib.exe with /DEF, rather than
pre-link step when building mysqld.exe.

This helps to avoid relinking all plugins, if mysqld.exe was recompiled
but the list of its exports has not changed.

Also removed unnecessary DEPENDS in some ADD_CUSTOM_COMMAND (gen_lex_token,
gen_lex_hash etc). They confuse VS generator which tends to
recreate headers and do unnecessary recompilations.
2017-04-03 18:48:48 +00:00
Vladislav Vaintroub
ff6f4d7db1 Windows : Fix compiling with VS2013
We do not use it now, but there is still no reason to break compilation
for other users.
2017-04-03 15:18:46 +00:00