Commit graph

173973 commits

Author SHA1 Message Date
Alexander Barkov
3f0d07e55b MDEV-9372 select 100 between 1 and 9223372036854775808 returns false
Integer comparison of INT expressions with different signess in BETWEEN
is not safe. Switching to DECIMAL comparison in case if INT arguments
have different signess.
2016-04-22 16:04:20 +04:00
Sergey Vojtovich
250a89cfec MDEV-9283 - Debian: the Lintian complains about "shlib-calls-exit" in
ha_oqgraph.so

exit() was called by Judy error handler. This patch overrides Judy error handler
so that it calls abort() instead of exit().
2016-04-22 15:30:10 +04:00
Sergey Vojtovich
994030c0e2 MDEV-8889 - Assertion `next_insert_id == 0' failed in handler::ha_external_lock
There was a race condition between delayed insert thread and connection thread
actually performing INSERT/REPLACE DELAYED. It was triggered by concurrent
INSERT/REPLACE DELAYED and statements that flush the same table either
explicitely or implicitely (like FLUSH TABLE, ALTER TABLE, ...).

This race condition was caused by a gap in delayed thread shutdown logic,
which allowed concurrent connection running INSERT/REPLACE DELAYED to change
essential data consequently leaving table in semi-consistent state.

Specifically query thread could decrease "tables_in_use" reference counter in
this gap, causing delayed insert thread to shutdown without releasing auto
increment and table lock.

Fixed by extending condition so that delayed insert thread won't shutdown
until there're locked tables.

Also removed volatile qualifier from tables_in_use and stacked_inserts since
they're supposed to be protected by mutexes.
2016-04-22 13:01:15 +04:00
Jan Lindström
298e1d3f71 Improve error diagnostics on I/O errors. If node->name is NULL
try to use space->name instead.
2016-04-22 11:36:10 +03:00
Jan Lindström
628bc576b3 MDEV-9918: [ERROR] mysqld got signal 11 during ALTER TABLE name COLUMN ADD
Problem was that in-place online alter table was used on a table
that had mismatch between MySQL frm file and InnoDB data dictionary.
Fixed so that traditional "Copy" method is used if the MySQL frm
and InnoDB data dictionary is not consistent.
2016-04-22 08:57:07 +03:00
Igor Pashev
e5410da190 SEGFAULT in get_column_grant()
Due to a typo, the wrong grant_table was used when fetching privileges
for roles.

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
2016-04-21 08:18:54 -07:00
Sergei Golubchik
0991e19e9d Merge branch 'bb-5.5-serg' into 5.5 2016-04-20 20:25:46 +02:00
Vladislav Vaintroub
2a45fa900b MDEV-9836 Connection lost when using SSL
Don't read from socket in yassl in SSL_pending().
Just return size of the buffered processed data.
This is what OpenSSL is documented to do too:

  SSL_pending() returns the number of bytes which have been processed,
  buffered and are available inside ssl for immediate read.
2016-04-20 19:03:59 +02:00
Sergei Golubchik
63c834e7c4 Merge branch 'merge-xtradb-5.5' into 5.5 2016-04-20 18:56:41 +02:00
Sergei Golubchik
24ac546d0f use consistent error messaging for IGNORE
1. the same message text for INSERT and INSERT IGNORE
2. no new warnings in UPDATE IGNORE yet (big change for 5.5)

and replace a commonly used expression with a
named constant
2016-04-20 18:27:23 +02:00
Sergey Vojtovich
072ca71d26 MDEV-9281 - Debian: the Lintian complains about "shlib-calls-exit" in handlersocket.so
MDEV-9278 - Debian: the Lintian complains about "shlib-calls-exit" in ha_spider.so

Handlersocket handles errors in a way that it aborts program execution. In most
cases it is done via abort(). One exception was host/service resolution failure,
which was aborted with exit().

As a workaround replaced this exit() with abort() for symmetry with other error
handling.
2016-04-20 18:20:31 +04:00
Sergei Golubchik
9e826bfa36 trivial optimization
don't call write_bin_log() when binlog is known
to be disable
2016-04-20 15:28:44 +02:00
Sergei Golubchik
8f1f869f68 another test case for ER_DATA_OUT_OF_RANGE on insert
tests it with a non-const table too
2016-04-20 15:26:37 +02:00
Sergei Golubchik
b069d19284 Merge branch 'mysql/5.5' into 5.5 2016-04-20 15:25:55 +02:00
Sergey Vojtovich
0c0a865fad MDEV-9943 - TokuDB fails to compile with gcc 5.2.1
For some reason check_cxx_compiler_flag() passes result variable name down to
compiler:
https://github.com/Kitware/CMake/blob/master/Modules/CheckCXXSourceCompiles.cmake#L57

But compiler doesn't permit dashes in macro name, like in
-DHAVE_CXX_-fimplicit-templates.

Workarounded by renaming HAVE_CXX_-fimplicit-templates to
HAVE_CXX_IMPLICIT_TEMPLAES.
2016-04-20 15:59:19 +04:00
Elena Stepanova
62122ba5d5 MDEV-9953 Debian packages install broken 'maria' test suite which cannot be run
Debian packages create empty maria/t and maria/r directories,
and MTR cannot run maria.* tests
2016-04-20 10:51:34 +03:00
Alexander Barkov
e90f8b7a68 MDEV-9413 "datetime >= coalesce(c1(NULL))" doesn't return expected NULL
The patch for MDEV-9521 earlier fixed the problem reported in MDEV-9413.
Only adding tests.
2016-04-20 11:11:13 +04:00
Alexander Barkov
2564650fb9 MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool)
The patch for MDEV-9745 earlier fixed the problem reported in MDEV-9662 as well.
Only adding tests.
2016-04-20 11:02:34 +04:00
Alexander Barkov
9a987142f9 MDEV-9745 Crash with CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END
This is a backport of the patch for MDEV-9653 (fixed earlier in 10.1.13).

The code in Item_func_case::fix_length_and_dec() did not
calculate max_length and decimals properly.

In case of any numeric result (DECIMAL, REAL, INT) a generic method
Item_func_case::agg_num_lengths() was called, which could erroneously result
into a DECIMAL item with max_length==0 and decimals==0, so the constructor of
Field_new_decimals tried to create a field of DECIMAL(0,0) type,
which caused a crash.

Unlike Item_func_case, the code responsible for merging attributes in
Item_func_coalesce::fix_length_and_dec() works fine: it has specific execution
branches for all distinct numeric types and correctly creates a DECIMAL(1,0)
column instead of DECIMAL(0,0) for the same set of arguments.

The fix does the following:
- Moves the attribute merging code from Item_func_coalesce::fix_length_and_dec()
  to a new method Item_func_hybrid_result_type::fix_attributes()
- Removes the wrong code from Item_func_case::fix_length_and_dec()
  and reuses fix_attributes() in both Item_func_coalesce::fix_length_and_dec()
  and Item_func_case::fix_length_and_dec()
- Fixes count_real_length() and count_decimal_length() to get an array
  of Items as an argument, instead of using Item::args directly.
  This is needed for Item_func_case::fix_length_and_dec().
- Moves methods Item_func::count_xxx_length() from "public" to "protected".
- Removes Item_func_case::agg_num_length(), as it's not used any more.
- Additionally removes Item_func_case::agg_str_length(),
  as it also was not used (dead code).
2016-04-20 08:53:30 +04:00
Sergey Vojtovich
6c0e231c02 MDEV-9945 - main.kill_processlist-6619 fails sporadically
SHOW PROCESSLIST output can be affected by not completed concurrent queries.
Removed this affected SHOW PROCESSLIST since it doesn't seem to affect original
problem.
2016-04-19 14:05:52 +04:00
Sergei Golubchik
1bc0b0b524 fix a couple of dbug tests not to write to /tmp 2016-04-19 11:27:00 +02:00
Sergei Golubchik
cc04a9fc0f MDEV-9835 Valid password is not working after server restart
On SET PASSWORD if the plugin is mysql_native_password
or mysql_old_password, do reset plugin and auth_str
fields.
2016-04-19 11:27:00 +02:00
Sergei Golubchik
608c0e1c22 MDEV-5982 make fail @ ".../libmysql_versions.ld:155:9: invalid use of VERSION in input file"
add a workaround for gold
2016-04-19 11:27:00 +02:00
Sergei Golubchik
ce355304e6 MDEV-9885 Client doesn't start if 'TERM' unknown
1. don't exit if setupterm() failed
2. don't use vidattr() if setupterm() failed
2016-04-19 11:27:00 +02:00
Sergei Golubchik
95fe71afa6 MDEV-9707 MAX(timestamp(6) column) in correlated sub-query returns non-existent row data in original table
special treatment for  temporal values in
create_tmp_field_from_item().

old code only did it when result_type() was STRING_RESULT,
but Item_cache_temporal::result_type() is INT_RESULT
2016-04-19 11:27:00 +02:00
Sergei Golubchik
3294cd11f8 MDEV-9929 MariaDB segfaults on command "mysqld --version" with ignore-db-dir option on /etc/my.cnf
don't put command-line arguments into opt_ignore_db_dirs -
it is supposed to contain a malloc()'ed accumulated
list of all ignored dirs
2016-04-19 11:27:00 +02:00
Sergei Golubchik
4f133fbf79 MDEV-9493 --tc-heuristic-recover option values off by one
fix typelib to match defines:
#define TC_HEURISTIC_RECOVER_COMMIT   1
#define TC_HEURISTIC_RECOVER_ROLLBACK 2
2016-04-19 11:27:00 +02:00
Sergei Golubchik
edf71fd1d7 MDEV-9928 LC_TIME_NAMES=de_AT; unusual name for february
s/Feber/Februar/
2016-04-19 11:27:00 +02:00
Sergei Golubchik
9c64735986 MDEV-9748 Include Twin (mysys_err.h is included twice in mysys/my_copy.c) 2016-04-19 11:27:00 +02:00
Sergey Vojtovich
18ff6f654b MDEV-9944 - main.events_2 fails sporadically
Fixed wait condition in test case to actually wait for get_lock() completion
(not for lock acquisition as it was before). This removes sporadic extra row in
subsequent processlist queries.
2016-04-19 12:38:00 +04:00
Alexander Barkov
6fd54c01bb MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
Item_func_ifnull::date_op() and Item_func_coalesce::date_op() could
erroneously return 0000-00-00 instead of NULL when get_date()
was called with the TIME_FUZZY_DATES flag, e.g. from LEAST().
2016-04-18 23:15:15 +04:00
Sergei Golubchik
c9e56d5ca9 5.5.48-37.8 2016-04-18 17:38:05 +02:00
Kristian Nielsen
1cf852d874 MDEV-9383: Server fails to read master.info after upgrade 10.0 -> 10.1
In some cases, MariaDB 10.0 could write a master.info file that was read
incorrectly by 10.1 and could cause server to fail to start after an upgrade.

(If writing a new master.info file that is shorter than the old, extra
junk may remain at the end of the file. This is handled properly in
10.1 with an END_MARKER line, but this line is not written by
10.0. The fix here is to make 10.1 robust at reading the master.info
files written by 10.0).

Fix several things around reading master.info and read_mi_key_from_file():

 - read_mi_key_from_file() did not distinguish between a line with and
   without an eqals '=' sign.

 - If a line was empty, read_mi_key_from_file() would incorrectly return
   the key from the previous call.

 - An extra using_gtid=X line left-over by MariaDB 10.0 might incorrectly
   be read and overwrite the correct value.

 - Fix incorrect usage of strncmp() which should be strcmp().

 - Add test cases.
2016-04-08 10:31:03 +02:00
Monty
3f6125129f Fixed results 2016-04-07 20:38:21 +03:00
Monty
293cb04959 MDEV-9621 INSERT DELAYED fails on insert for tables with many columns
This fix also fixes a connection hang when trying to do INSERT DELAYED to a crashed table.

Added crash_mysqld.inc to allow easy crash+restart of mysqld
2016-04-07 19:31:10 +03:00
Vladislav Vaintroub
4b6a3518e4 Use _ReadWriteBarrier() rather than MemoryBarrier() for preventing compile optimization 2016-04-06 14:15:44 +02:00
Vladislav Vaintroub
fd7a8d18ea Fix compile error in UT_COMPILER_BARRIER on Visual Studio compiler. 2016-04-06 13:38:22 +02:00
Jan Lindström
9794cf2311 Merge pull request #168 from grooverdan/10.1-MDEV-8684-UT_RELAX_CPU_isnt_relaxing
MDEV-8684 ut relax cpu isnt relaxing
2016-04-06 08:50:59 +03:00
Elena Stepanova
f8adeccd78 MDEV-9713 Sporadic test failure: sys_vars.innodb_buffer_pool_load_now_basic
Previous fix using wait condition did not work because of MDEV-9867, so
we have to use conditional sleep instead. Sleep will only happen if the test
is executed after another one which also ran buffer pool dump without
server restart between two tests
2016-04-04 17:04:14 +03:00
Sergei Petrunia
04737330be MDEV-9860: TokuDB ORDER BY DESC query is slower in 10.1 with ICP ON
Implement ha_tokudb::cancel_pushed_idx_cond().

This is a conservative fix which follows the approach from the previous
patch for:
BUG#1000051: Query with simple join and ORDER BY takes thousands times...
2016-04-03 20:19:59 +03:00
Alexander Barkov
777c2131dd MDEV-9862 Illegal mix of collation, when comparing column with CASE expression 2016-04-02 00:04:47 +04:00
Daniel Black
26c38de804 MDEV-8684: Use POWER wrappers rather than direct asm
i.e. __ppc_set_ppr_low rather than 'or 1,1,1'
2016-04-01 09:38:17 +11:00
Jan Lindström
c395aad668 MDEV-9840: Test encryption.innodb-log-encrypt-crash fails on buildbot
Problem: We created more than 5 encryption keys for redo-logs.
Idea was that we do not anymore create more than one encryption
key for redo-logs but if existing checkpoint from earlier
MariaDB contains more keys, we should read all of them.

Fix: Add new encryption key to memory structure only if there
currently has none or if we are reading checkpoint from the log.
Checkpoint from older MariaDB version could contain more than
one key.
2016-03-31 13:12:48 +03:00
Daniel Black
64824a760d MDEV-8684: UT_RELAX_CPU on Power to non-empty expansion
Using __ppc_get_timebase will translate to mfspr instruction
The mfspr instruction will block FXU1 until complete but the other
Pipelines are available for execution of instructions from other
SMT threads on the same core.

The latency time to read the timebase SPR is ~10 cycles.

So any impact on other threads is limited other FXU1 only instructions
(basically other mfspr/mtspr ops).

Suggested by Steven J. Munroe, Linux on Power Toolchain Architect,
Linux Technology Center
IBM Corporation
2016-03-31 16:35:26 +11:00
Sergey Vojtovich
3d1a7cba71 MDEV-8684: Remove delaying maths in ut_delay
Also introduce compiler barrier properly on all architectures.
2016-03-31 16:35:19 +11:00
Yasufumi Kinoshita
d4ba50477e Some POWER specific optimizations
Bug#18842925 : SET THREAD PRIORITY IN INNODB MUTEX SPINLOOP
Like "pause" instruction for hyper-threading at Intel CPUs,
POWER has special instructions only for hinting priority of hardware-threads.

Approved by Sunny in rb#6256

Backport of the 5.7 fix - c92102a6ef
(excluded cache line size patch)

Suggestion by Stewart Smith
2016-03-31 16:34:56 +11:00
Marko Mäkelä
2275640deb Bug#20045167 UT_DELAY MISSING COMPILER BARRIER
UT_RELAX_CPU(): Use a compiler barrier.

ut_delay(): Remove the dummy global variable ut_always_false.

RB: 11399
Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com>

Backported from MySQL-5.7 - patch 5e3efb0396

Suggestion by Stewart Smith
2016-03-31 16:34:21 +11:00
Jan Lindström
37a65e3335 MDEV-9793: getting mysqld crypto key from key version failed
Make sure that we read all possible encryption keys from checkpoint
and if log block checksum does not match, print all found
checkpoint encryption keys.
2016-03-30 16:09:47 +03:00
Jan Lindström
4ddb9deaf3 MDEV-9678: Data Directory bug
MDEV-9833: Log files are opened using O_DIRECT causing problems if block size != 512

Fix typo.
2016-03-30 14:59:25 +03:00
Olivier Bertrand
6e48347d49 Merge branch 'ob-10.0' into 10.0 2016-03-25 18:11:21 +01:00