Commit graph

44795 commits

Author SHA1 Message Date
Sergey Vojtovich
0dbfc0fde7 Yet more fixes covering thread_id type change
Also fixed race condition in main.connect2 test: we need to wait for
disconnected connections to actually decrease Threads_connected.
2016-02-28 14:54:56 +04:00
Alexey Botchkov
0d10b5a5cd MDEV-8713 Add continuous binary log backup to mysqlbinlog.
--raw, --stop-never and --stop-never-slave-server-id=id options
        added to the mysqlbinlog tool.
2016-02-27 11:59:36 +04:00
Sergey Vojtovich
90c9641a8a MDEV-7331 - information_schema.user_variables 2016-02-26 18:35:14 +04:00
Sergei Golubchik
00d1db7a38 Merge branch '10.1' into 10.2 2016-02-25 18:19:55 +01:00
Sergei Petrunia
b05158cc10 MDEV-8988: Apparently valid SQL query gives wrong result (nested WHERE)
- "Early NULLs filtering" optimization used to "peel off" Item_ref and
  Item_direct_ref wrappers from an outside column reference before
  adding "outer_table_col IS NOT NULL" into JOIN::outer_ref_cond.
- When this happened in a subquery that was evaluated in a post-GROUP-BY
  context, attempt to evaluate JOIN::outer_ref_cond would fetch an
  incorrect value of outer_table_col.
2016-02-24 17:18:53 +03:00
Sergei Golubchik
d044507dc5 Merge branch 'bb-10.1-serg' into 10.1
10.0 merge
10.0-galera merge
connect/10.1 merge
2016-02-24 10:27:23 +01:00
Alexander Barkov
ff2d92b17d MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.ROUTINES
contains broken procedure body when used shielding quotes inside.
2016-02-24 13:12:03 +04:00
Sergei Golubchik
a5679af1b1 Merge branch '10.0' into 10.1 2016-02-23 21:35:05 +01:00
Sergei Golubchik
20c4dfd4a9 MDEV-9576 syntax error on view with nullif and count
don't transform Item_func_nullif if it's context_analysis_only
2016-02-23 10:54:36 +01:00
Sergei Golubchik
9214d043fd disable SHOW I_S_table for built-in I_S tables
This fixes
MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
2016-02-23 10:54:34 +01:00
Sergei Golubchik
57905d18d6 MDEV-9535 Trigger doing "SET NEW.auctionStart = NOW();" on a timestamp kills MariaDB server
when doing set_field_to_new_field (from switch_to_nullable_trigger_fields())
make sure that the field we're about to change actually belongs
to the right table (otherwise we cannot dereference new_field[]
array as the wrong table might have more fields than
new_field[] has elements)
2016-02-23 10:54:34 +01:00
Sergei Golubchik
0fcd0ee34e MDEV-9500 Bug after upgrade to 10.1.10 (and 10.1.11)
Case: table with a NOT NULL field, BEFORE UPDATE trigger,
and UPDATE with a subquery that uses GROUP BY on that
NOT NULL field, and needs a temporary table for it.

Because of the BEFORE trigger, the field becomes nullable
temporarily. But its Item_field (used in GROUP BY) doesn't.
When working with the temptable some code looked at
item->maybe_null, some - at field->null_ptr.
The fix: make Item_field nullable when its field is.

This triggers an assert. The group key size is calculated
before the item is made nullable, so the group key doesn't
have a null byte. The fix: make fields/items nullable
before the group key size is calculated.
2016-02-23 10:53:53 +01:00
Vladislav Vaintroub
3a24f1cf84 MDEV-9307 - provide info about DATA/INDEX directory in INFORMATION_SCHEMA.TA
BLES (in CREATE_OPTIONS column)
2016-02-22 12:48:03 +01:00
Oleksandr Byelkin
4b08b10b3a MDEV-9489:Assertion `0' failed in Protocol::end_statement() on UNION ALL
Restoring currect_select fixed.
2016-02-21 22:16:17 +01:00
Sergei Golubchik
a4b2714968 Merge branch 'bb-10.0-serg' into 10.0 2016-02-17 21:42:57 +01:00
Alexander Barkov
09b5865460 MDEV-9511 Valgrind warnings 'Invalid read' in Field_newdate::cmp and Field_newdate::val_str 2016-02-17 08:05:00 +04:00
Sergei Golubchik
271fed4106 Merge branch '5.5' into 10.0 2016-02-15 22:50:59 +01:00
Sergei Golubchik
9630eda0de MDEV-9390 Function found_rows() gives incorrect result where the previous SELECT contains ORDER BY clause
use the raw found_rows value only when SQL_CALC_FOUND_ROWS was specified
2016-02-15 13:02:21 +01:00
Sergei Golubchik
38b89a61c3 MDEV-9103 Altering table comment does a full copy
following InnoDB's logic, altering a comment or a default
field's value needs "NO_LOCK", not EXCLUSIVE
2016-02-15 13:02:21 +01:00
Alexander Barkov
a9a08b1e2f MDEV-9371 select insert('a',2,1,'b') doesn't return expected 'a' 2016-02-10 10:03:47 +04:00
Oleksandr Byelkin
6b614c620e MDEV-7765: Crash (Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))' fails) on using function over not created table
Problem was that created table was not marked as used (not set query_id) and so opening tables for stored function pick it up (as opened place holder for it) and used changing TABLE internals.
2016-02-09 18:58:54 +01:00
Vicențiu Ciorbaru
775cccca9f MDEV-7122: Assertion `0' failed in subselect_hash_sj_engine::init
The select mentioned in the bug attempted to create a temporary table
using the maria storage engine. The table needs to have primary keys such that
duplicates can be removed. Unfortunately this use case has a longer
than allowed key and the tmp table got created without a temporary key.
We must not allow materialization for the subquery if the total key
length and key parts is greater than what the storage engine supports.
2016-02-09 19:02:25 +02:00
Sergei Golubchik
01628ce35a Merge branch 'bb-5.5-serg' into 5.5 2016-02-09 14:08:36 +01:00
Sergei Golubchik
5d478f5339 Bug#19817021
test case for ALTER TABLE view CHECK PARTITION
2016-02-09 11:29:06 +01:00
Sergei Golubchik
6703e5b6da Bug#20691429 ASSERTION `CHILD_L' FAILED IN STORAGE/MYISAMMRG/HA_MYISAMMRG.CC:631
test case
2016-02-09 11:28:59 +01:00
Sergei Golubchik
f3444df415 Merge branch 'mysql/5.5' into 5.5
reverted about half of commits as either not applicable or
outright wrong
2016-02-09 11:27:40 +01:00
Sergei Petrunia
b17a435069 MDEV-6859: scalar subqueries in a comparison produced unexpected result
When one evaluates row-based comparison like (X, Y) = (A,B), one should
first call bring_value() for the Item that returns row value. If you
don't do that and just attempt to read values of X and Y, you get stale
values.
Semi-join/Materialization can take a row-based comparison apart and
make ref access from it. In that case, we need to call bring_value()
to get the index lookup components.
2016-02-09 02:31:47 +03:00
Sergei Petrunia
d443d70d06 MDEV-7823: Server crashes in next_depth_first_tab on nested IN clauses with SQ inside
Consider a query with subquery in form t.key=(select ...). Suppose, the
parent query uses this equality for ref access.
It will attempt to evaluate the subquery in get_best_combination(),
right before the join->join_tab[...] array is filled.  The problem was
that subquery optimization will attempt to look at parent's join->join_tab
to check how many times subquery will be executed (and crash).

Fixed by not doing that when the subquery is constant (non-constant
subqueries are only be evaluated during join execution, so they are not
affected)
2016-02-09 01:46:53 +03:00
Monty
3d4a7390c1 MDEV-6150 Speed up connection speed by moving creation of THD to new thread
Creating a CONNECT object on client connect and pass this to the working thread which creates the THD.
Split LOCK_thread_count to different mutexes
Added LOCK_thread_start to syncronize threads
Moved most usage of LOCK_thread_count to dedicated functions
Use next_thread_id() instead of thread_id++

Other things:
- Thread id now starts from 1 instead of 2
- Added cast for thread_id as thread id is now of type my_thread_id
- Made THD->host const (To ensure it's not changed)
- Removed some DBUG_PRINT() about entering/exiting mutex as these was already logged by mutex code
- Fixed that aborted_connects and connection_errors_internal are counted in all cases
- Don't take locks for current_linfo when we set it (not needed as it was 0 before)
2016-02-07 10:34:03 +02:00
Monty
b2f8d7b410 Merge branch '10.1' into 10.2
Conflicts:
	VERSION
	cmake/plugin.cmake
	config.h.cmake
	configure.cmake
	plugin/server_audit/server_audit.c
	sql/sql_yacc.yy
2016-02-06 18:14:54 +02:00
Oleksandr Byelkin
41021c0254 MDEV-9462: Out of memory using explain on 2 empty tables
Fixed adding derived tables items to outer one.
2016-02-06 13:36:17 +01:00
Sergei Golubchik
ad94790f46 MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb
mysqlcheck tool can be used even if opt_systables_only is true
(to upgrade views from mysql - that overrides opt_systables_only)
2016-02-06 11:45:23 +01:00
Sergei Golubchik
0a76ad5ffd MDEV-9175 Query parser tansforms MICROSECOND into SECOND_FRAC, which does not work 2016-02-06 11:45:23 +01:00
Oleksandr Byelkin
6ecf6d8453 MDEV-7827: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_long::val_str on EXPLAIN EXTENDED
(Solution by Sergei Petrunia)
It appeared that semijoin conditions was not iterated when we were updating used tables. So now they do.
2016-02-05 17:46:01 +01:00
Sergei Petrunia
07b8aefe90 MDEV-9504: ANALYZE TABLE shows wrong 'rows' value for ORDER BY query
Revert the patch for MDEV-9504.
It causes test failures, attempt to fix these causes more failures. The
source of all this is that the code in test_if_skip_sort_order() has
a peculiar way of treating select_limit parameter:
Correct value is computed when the query plan is changed. In other cases,
we use an approximation that ignores the presence of GROUP BY clause,
or JOINs, or both.

A patch that fixes all of the above would be too big to do in 10.1
2016-02-03 00:17:55 +03:00
Monty
11c2d3c3e2 Merge branch '10.0' into 10.1
Conflicts:
	configure.cmake
2016-02-02 13:07:53 +02:00
Vladislav Vaintroub
52d695fef4 Fix authentication plugin's tests in case username contains non-alphanumeric character, e.g dash 2016-02-01 17:51:57 +01:00
Sergei Petrunia
74f15e2a7f MDEV-9505: Valgrind failure in SEL_ARG::store_min,find_used_partitions
create_partition_index_description() had wrong logic to calculate
length of the key value buffer that is used by the range optimizer.

For some reason it used MAX(partitioning_columns_len,
subpartitioning_columns_len) while it should use SUM of these values.
2016-02-01 19:36:22 +03:00
Sergei Petrunia
e6dee57f1a MDEV-9504: ANALYZE TABLE shows wrong 'rows' value for ORDER BY query
- Legacy code would set JOIN_TAB::limit only for EXPLAIN queries (this
  variable is only used when producing EXPLAIN output)

- ANALYZE/SHOW EXPLAIN need to produce EXPLAIN output for non-EXPLAIN
  queries, too, so we should always set JOIN_TAB::limit.
2016-02-01 19:07:46 +03:00
Alexander Barkov
ce40ccaf24 MDEV-9181 (NULLIF(count(table.col)), 0) gives wrong result on 10.1.x
Wrapping args[0] and args[2] into an Item_cache for aggregate functions.
2016-01-28 13:58:39 +04:00
Oleksandr Byelkin
07e9762940 MDEV-8615: Assertion `m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_start
Nothing should be done before any keyword recognized.
2016-01-27 21:17:23 +01:00
Vladislav Vaintroub
4b31e6dc95 Address review comments, add unit test 2016-01-27 16:34:05 +01:00
Alexander Barkov
b404b236a2 MDEV-9332 Bug after upgrade to 10.1.10 2016-01-27 11:42:31 +04:00
Alexey Botchkov
a4ff37e912 MDEV-6421 SQL_ERROR_LOG doesn't log comments in Events.
Change parser so it saves all the query line to the ';' in the
    sp_instr::m_query.
2016-01-26 22:33:25 +04:00
Sergei Golubchik
2ff65ba531 MDEV-9299 Test main.events_2 incompatible with Debian reproducibility testing framework
Debian tests are run in 2017, update the test to
use 2027 as a "future".
2016-01-25 22:57:56 +01:00
Sergei Golubchik
5da7c346c7 MDEV-9428 NO_AUTO_VALUE_ON_ZERO is ignored when a trigger before insert is defined
Don't compare "field == table->next_number_field" because the field
can be special nullable field copy created by the trigger.
Compare field_index values instead.
2016-01-25 22:57:54 +01:00
Sergei Petrunia
ff8d4009a7 MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1
Undo the change in test_if_skip_sort_order() that set ref_key=-1 when
a variant of index_merge is used (was made in fix for MDEV-9021).

It turned out that test_if_cheaper_ordering() call below assumes that
ref_key=-1 means "no index is used", that is, "an inefficient full table
scan is done".
This is not the same as index_merge, index_merge can actually be quite
efficient. So, ref_key=MAX_KEY denotes the fact that some index is used,
not any given index.
2016-01-24 16:59:41 +03:00
Oleksandr Byelkin
825f51d1aa MDEV-9118 ANALYZE TABLE for Engine independent status fetchs blob/text columns without use
Do not include BLOB fields by default.
2016-01-22 18:07:11 +01:00
Alexander Barkov
7b50447aa6 MDEV-9407 Illegal mix of collation when using GROUP_CONCAT in a VIEW
MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view

There were three almost identical pieces of the code:
- Field *Item_func::tmp_table_field();
- Field *Item_sum::create_tmp_field();
- Field *create_tmp_field_from_item();
with a difference in very small details (hence the bugs):
Only Item_func::tmp_table_field() was correct, the other two were not.
Removing the two incorrect pieces of the redundant code.
Joining these three functions/methods into a single virtual method
Item::create_tmp_field().
Additionally, moving Item::make_string_field() and
Item::tmp_table_field_from_field_type() from the public into the
protected section of the class declaration, as they are now not
needed outside of Item.
2016-01-16 18:45:26 +04:00
Alexander Barkov
454589b67f MDEV-9393 Split Copy_field::get_copy_func() into virtual methods in Field
Also fixes:
MDEV-9391 InnoDB does not produce warnings when doing WHERE int_column=varchar_column
MDEV-9337 ALTER from DECIMAL and INT to DATETIME returns a wrong result
MDEV-9340 Copying from INT/DOUBLE to ENUM is inconsistent
MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings
2016-01-11 17:20:16 +04:00