Commit graph

183670 commits

Author SHA1 Message Date
Igor Babaev
d03581bf3c MDEV-17360 Server crashes in optimize_keyuse
This was a bug in the code of MDEV-12387 "Push conditions into materialized
subqueries". The bug manifested itself in rather rare situations. An
affected query must contain IN subquery predicate whose left operand
was an outer field of a mergeable derived table or view and right operand
was a materialized subquery.
The erroneous code in fact stripped off the Item_direct_ref wrapper from
the left operand of the IN subquery predicate when building equalities
produced by the conversion of the predicate into a semi-join. As a result
the left operand was not considered as an outer reference anymore and
used_tables() was calculated incorrectly. This caused a crash in the
function optimize_keyuse().
2018-10-07 12:18:38 -07:00
Vladislav Vaintroub
52f326cfb7 Merge branch 'bb-10.4-wlad' into 10.4 2018-10-05 10:33:50 +01:00
Vladislav Vaintroub
98473a8399 Small refactoring in vio.
- remove function prototype for shared memory (no more used), and VIO
members that are unused
 - Do not call DisconnectNamedPipe on pipe handle. CloseHandle() is enough.
2018-10-05 09:36:02 +01:00
Vladislav Vaintroub
8f329e8d37 MDEV-10384 Windows : Refactor threading in mysqld startup.
Remove threads that are doing nothing but wait
- main thread now handles the connections
(if threadpool is used, also threadpool threads would wait for connections)
- thread for socket and pipe connections are removed
- shutdown thread is now removed, we wait for shutdown
notification in main thread as well
- kill_server() is also called inside the main thread, after connection
loop finished.
2018-10-05 09:29:22 +01:00
Marko Mäkelä
444c380ceb Merge 10.3 into 10.4 2018-10-05 08:09:49 +03:00
Marko Mäkelä
941ca92a2c MDEV-11369: Perform validation at IMPORT TABLESPACE
btr_cur_instant_root_init(): Check the "infimum" and "supremum"
record strings already here, and not later in btr_cur_instant_root_init().
In this way, we can properly reject files from later versions where
instant ALTER TABLE could support further operations that change the
format of InnoDB clustered indexes.
2018-10-04 16:12:04 +03:00
Marko Mäkelä
2badefb066 Fix a Galera result 2018-10-04 16:08:25 +03:00
Marko Mäkelä
ae4f464fd6 MDEV-11369: Implement accurate checks for the metadata record
Because changes of the FIL_PAGE_TYPE or PAGE_INSTANT in the root
page are not undo-logged, it is possible that the fields suggest
that instant ADD COLUMN is in effect, even though no metadata
record exists. If the fields are set, proceed to fetch the
metadata record. If the metadata record does not exist, return
success if !index->is_instant().

Also, check that the "infimum" and "supremum" records carry the
strings in the root page. In a later format that supports instant
DROP COLUMN, we will have to store more information in the root
page, so that index->n_core_null_bytes can be determined accurately.
2018-10-03 11:16:40 +03:00
Marko Mäkelä
c134f565c4 MDEV-11369: Implement stricter checks for the metadata record
btr_cur_instant_init_low(): If columns were instantly added and dropped,
then index->is_instant() might not hold even though the root page type
was FIL_PAGE_TYPE_INSTANT. MariaDB 10.3 must refuse to open such files,
because instant DROP COLUMN is not supported.

Also, refuse to open the table if the metadata record has
wrong info OR status bits. Previously, we only refused to open
if both bits were wrong.
2018-10-03 09:20:44 +03:00
Jan Lindström
15c7225a08
Merge pull request #847 from tempesta-tech/tt-10.3-MDEV-16211
MDEV-16211 Contents of transaction_registry should not be replicated by Galera
2018-10-02 15:12:13 +03:00
Elena Stepanova
0c724a0c7d Updated list of unstable tests for 10.3.10 release
Addition based on Travis results
2018-10-02 13:46:20 +03:00
Sergey Vojtovich
bad2f1569d MDEV-17167 - InnoDB: Failing assertion: table->get_ref_count() == 0 upon
truncating a temporary table

TRUNCATE expects only one TABLE instance (which is used by TRUNCATE
itself) to be open. However this requirement wasn't enforced after
"MDEV-5535: Cannot reopen temporary table".

Fixed by closing unused table instances before performing TRUNCATE.
2018-10-02 13:42:44 +04:00
Elena Stepanova
b9a5ff3644 Updated list of unstable tests for 10.3.10 release 2018-10-02 00:33:42 +03:00
Eugene Kosov
44016ec0ca MDEV-16211 Contents of transaction_registry not replicated by Galera
Patch fixes two bugs:
1) BEGIN_TIMESTAMP of MYSQL.TRANSACTION_REGISTY is '0-0-0' on replication record insertion
2) BEGIN_TIMESTAMP equals COMMMIT_TIMESTAMP in MYSQL.TRANSACTION_REGISTRY

Fixed by calling THD::set_time() at appropriate places
2018-10-01 17:53:20 +03:00
Alexander Barkov
55dd077656 MDEV-17331 Reuse Temporal_hybrid in xxx_to_date_with_warn() 2018-10-01 15:05:19 +04:00
Alexander Barkov
e5aebc1408 A cleanup for MDEV-17317 Add THD* parameter into Item::get_date() and stricter data type control to "fuzzydate"
Fixing C++ function check_date() to get the "fuzzydate" as
date_mode_t rather than ulonglong, so conversion from
date_time_t to ulonglong is now done inside C++ check_date(),
and no conversion is needed in the callers' code.

As an additional safety, modified the code not to pass
TIME_FUZZY_DATE to the low level C functions:
- check_date()
- str_to_datetime()
- str_to_time()
- number_to_datetime()
because TIME_FUZZY_DATE is known only on the C++ level,
C functions do not know it.

Soon we'll be adding more flags into the C++ level (i.e. to date_time_t),
e.g. for rounding. It's a good idea to prevent passing C++ specific
flags into pure C routines before this change.

Asserts were added into the affected C functions to verify
that the caller passed only known C level flags.
2018-10-01 12:34:03 +04:00
Sergei Golubchik
9556d56da2 Merge branch '10.3' 2018-10-01 10:28:22 +02:00
Marko Mäkelä
5aa18f4e08 row_build_index_entry(): Make index const 2018-10-01 09:31:50 +03:00
Marko Mäkelä
c58e502455 Remove an unused function
rec_offs_nth_extern_old() was introduced in
commit a4948dafcd
and never used.
2018-09-30 21:03:13 +03:00
Marko Mäkelä
ac8c7a1c08 Fix -Wunused-variable 2018-09-30 21:03:13 +03:00
Alexander Barkov
f79bab3ae6 MDEV-17318 CAST(LEAST(zero_date,non_zero_date) AS numeric_data_type) returns a wrong result
Also fixes:
MDEV-17330 Wrong result for 0 + LEAST(TIME'-10:00:00',TIME'10:00:00')

Problems:

1. These methods did not take into account the current session date flags
and passed date_mode_t(0) to func->get_date():

Type_handler_temporal_result::Item_func_min_max_val_real
Type_handler_temporal_result::Item_func_min_max_val_int
Type_handler_temporal_result::Item_func_min_max_val_decimal

Fixing to pass sql_mode_for_dates(thd) instead of date_mode_t(0).
Note, sql_mode_for_dates(thd) is only needed for DATE/DATETIME
data types. It is not needed for TIME.
So splitting value methods Type_handler_temporal_result::Item_func_min_max_xxx
into individual implementations for
Type_handler_{time|date|datetime|timestamp}_common
and, instead of calling get_date(), reusing inside classes
Time(), Date(), Datetime() and their methods to_longlong().
sql_mode_for_dates(thd) is automatically passed to get_date()
inside Date() and Datetime() constructors.

The switch to classes also fixed the problem reported in MDEV-17330.
Type_handler_temporal_result::Item_func_min_max_val_int() used to
call TIME_to_ulonglong(), which was not correct for TIME.
Changing the code to use Time().to_longlong() solved this.

2. Type_handler_temporal_result::Item_func_min_max_get_date
also did not take into account the current session
date flags in case of conversion from DATE/DATETIME to time
and passed date_mode_t(0) to get_date_native().
Fixing to pass sql_mode_for_dates(thd) in case of conversion
from DATE/DATETIME to TIME.
2018-09-30 17:24:19 +04:00
Alexander Barkov
23740441d8 MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE 2018-09-29 21:20:24 +04:00
Sergei Golubchik
b154d302fa memory leak when updating @@rocksdb_update_cf_options 2018-09-28 23:10:37 +02:00
Sergei Golubchik
556f058ab2 ASAN error when strlen(db) < 6 2018-09-28 18:04:26 +02:00
Sergei Golubchik
c47c0ca50c mtr: uninitialized warning (if --manual-gdb or --boot-gdb) 2018-09-28 16:38:01 +02:00
Sergei Golubchik
6d2c70bc55 Update test result (after galera library upgrade?) 2018-09-28 16:37:55 +02:00
Sergei Golubchik
57e0da50bb Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
Alexander Barkov
ad8e02ac45 MDEV-17317 Add THD* parameter into Item::get_date() and stricter data type control to "fuzzydate" 2018-09-28 14:01:17 +04:00
Alexander Barkov
492998c0d8 MDEV-15406 NO_ZERO_IN_DATE erroneously affects how CAST(AS DATE) warns about fractional digit truncation 2018-09-27 16:38:14 +04:00
Alexander Barkov
786940d7e0 MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in Field_time::store_TIME_with_warning 2018-09-26 20:14:47 +04:00
Marko Mäkelä
85cdb63f77 Correct a function comment 2018-09-26 17:18:13 +03:00
Alexander Barkov
25ad38abe5 MDEV-17288 Replace Item_func::get_arg0_date() to Date/Datetime methods 2018-09-25 10:07:45 +04:00
Sergei Golubchik
dcbd51cee6 update libmariadb 2018-09-24 15:34:23 +02:00
Sergei Golubchik
5ae8fce50b Merge branch '10.1' into 10.2 2018-09-24 11:46:08 +02:00
Sergei Golubchik
76098f45b8 RocksDB: workaround a compiler error on ppc64le
storage/rocksdb/rdb_datadic.cc: In member function 'int myrocks::Rdb_key_def::unpack_integer(myrocks::Rdb_field_packing*, Field*, uchar*, myrocks::Rdb_string_reader*, myrocks::Rdb_string_reader*) const'
storage/rocksdb/rdb_datadic.cc:1781:1: internal compiler error: Segmentation fault
 }

on ppc64le, ubuntu bionic gcc 7.3.0 and debian stretch gcc 6.3.0

The error happens with -ftree-loop-vectorize when trying to vectorize
a particular loop (see Rdb_key_def::unpack_integer())

Compiler gets confused by __attribute__((optimize("O0")) that comes from
ha_rocksdb_proto.h. The intention of this __attribute__ was to prevent
function from being inlined (see ha_rocksdb.cc). Let's use a more
specific attribute that prevents inlining but does not confuse
loop vectorizer.
2018-09-23 19:17:56 +02:00
Sergei Golubchik
1fc5a6f30c Merge branch '10.0' into 10.1 2018-09-23 12:58:11 +02:00
Jan Lindström
87dc4e98dd MDEV-17276: Adjust Galera tests after Galera library 25.3.24 2018-09-23 13:53:57 +03:00
Sergei Petrunia
2b45eb77f7 MDEV-17261: sysbench oltp read only too slow for MyRocks
An error in "group commit with MariaDB's binlog" code: we would flush
the WAL even when the transaction did not do any writes (and so the logic
in myrocks::Rdb_transaction::commit caused it to rollback).
2018-09-23 13:41:08 +03:00
Jan Lindström
eefaf4fdc9 Adjust disabled Galera tests. 2018-09-23 13:26:25 +03:00
Jan Lindström
428669fa83 MDEV-15805: Test failure on galera.query_cache
Reset query cache after every test case and add wait after
load infile.
2018-09-23 13:26:10 +03:00
Sergei Golubchik
1144acbcbd tokudb: create and destroy TOKUDB_SHARE::_open_tables_mutex dynamically
to guarantee that it's destroyed when plugin deinit is called, not after
2018-09-22 20:18:17 +02:00
Alexander Barkov
50003a9508 MDEV-17274 Split Field_temporal_with_date::store*() for Field_date_common and Field_datetime 2018-09-22 18:33:07 +04:00
Sergei Golubchik
7aba6f8f88 fix galera_sst_rsync_data_dir again
(already fixed in 10.2. bad merge?)
2018-09-22 15:36:27 +02:00
Sergei Golubchik
3a9276bad3 sanitize tokudb locking macros 2018-09-22 15:19:40 +02:00
Sergei Golubchik
61a6f4bd96 MDEV-14560 Extra engines enabled through additional config are not loaded on first installation
Use RedHat-recommended /var/lib/rpm-state/mariadb/ for restart flag.
This also fixes SUSE where /var/lib/rpm-state doesn't necessarily exist.
2018-09-22 00:20:25 +02:00
Sergei Golubchik
e7d152293d MDEV-13089 identifier quoting in partitioning
cover ALTER TABLE
2018-09-21 20:22:14 +02:00
Sergei Golubchik
e4b466aa3d MDEV-16792 Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno or wrong result upon SHOW TABLE STATUS after adding partition under ANSI_QUOTES
if opening a table fails with a syntax error, the error shouldn't
be suppressed completely as if it didn't happen at all.
2018-09-21 19:56:55 +02:00
Alexander Barkov
a4131c51f5 Merge remote-tracking branch 'origin/5.5' into bb-10.0-bar 2018-09-21 18:17:32 +04:00
Alexander Barkov
fc70f21e0a Fixing the comment not to mention the removed class Item_copy_int. 2018-09-21 18:04:56 +04:00
Alexander Barkov
b514a5f9e8 A cleanup for MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
Unary minus operation for the smallest possible signed long long value
(LONLONG_MIN) is undefined in C++. Because of this, func_time.test
failed on ppc64 buildbot machines.

Fixing the code to avod using undefined operations.

This is fix is similar to "MDEV-7973 bigint fail with gcc 5.0"
2018-09-21 18:03:23 +04:00