Commit graph

174172 commits

Author SHA1 Message Date
Nirbhay Choubey
23fed78404 MDEV-6368: assertion xid_seqno > trx_sys_cur_xid_seqno (postfix)
- Fix build failure when built without wsrep (Win)
- Update the expected warning in sys_vars.wsrep_start_position
2016-06-01 13:15:38 -04:00
Sergey Vojtovich
d6d4011211 Move wait_for_mdl_deadlock_detector() call to tc_remove_table()
As a side effect tc_remove_all_unused_tables() has to call
tc_wait_for_mdl_deadlock_detector() once per TABLE object now, while it called
it only once before. This should be acceptable since actual wait will still be
performed only once. It only adds redundant checks for all_tables_refs.
2016-06-01 17:54:23 +04:00
Sergey Vojtovich
41dc2fc129 Move table cache private functions out of header
This is mostly needed to hide all references to free_tables, so that further
implementation of multi-instance list can be done completely inside
table_cache.cc
2016-06-01 17:14:43 +04:00
Sergey Vojtovich
f7048e9a92 Move common code to a separate function 2016-06-01 16:43:22 +04:00
Alexander Barkov
286416404a MDEV-10101 Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP) 2016-06-01 15:31:26 +04:00
Alexander Barkov
caee832df1 MDEV-10124 Incorrect usage of CUBE/ROLLUP and ORDER BY with GROUP_CONCAT(a ORDER BY a)
Allowing GROUP_CONCAT(... ORDER BY ..) in queries with ROLLUP.

The story of the related code:

1. The original patch from Wax
commit: 0b505fb437
date: Tue Mar 18 03:07:40 2003

opt_gorder_clause reused the regular order_clause,
which already had some protection against ROLLUP queries:

order_clause:
        ORDER_SYM BY
        {
          LEX *lex=Lex;
          if (lex->current_select->linkage != GLOBAL_OPTIONS_TYPE &&
              lex->current_select->select_lex()->olap !=
              UNSPECIFIED_OLAP_TYPE)
          {
            net_printf(lex->thd, ER_WRONG_USAGE,
                       "CUBE/ROLLUP",
                       "ORDER BY");
            YYABORT;
          }
        } order_list;

The assumption that ORDER BY in group_concat() had to have
the same ROLLUP restriction (with order_clause) was wrong.

Moreover, GROUP_CONCAT() in select_item_list was not affected
by this restriction, because WITH ROLLUP goes after
select_item_list and therefore sel->olap is always equal
to UNSPECIFIED_OLAP_TYPE during select_item_list.

GROUP BY was not affected for two reasons:
- it goes before WITH ROLLUP and sel->olap is still
  UNSPECIFIED_OLAP_TYPE
- Aggregate functions like AVG(), GROUP_CONCAT() in GROUP BY
  are not allowed

So only GROUP_CONCAT() in HAVING and ORDER BY clauses
were erroneously affected by this restriction.

2. Bug#27848 rollup in union part causes error with order of union
commit: 3f6073ae63
Author: unknown <igor@olga.mysql.com>  2007-12-15 01:42:46

The condition in the ROLLUP protection code became more complex.
Note, opt_gconcat_order still reused the regular order_clause.

3. Bug#16347426 ASSERTION FAILED: (SELECT_INSERT &&
                 !TABLES->NEXT_NAME_RESOLUTION_TABLE) || !TAB
commit: 2d83663380
author: Chaithra Gopalareddy <chaithra.gopalareddy@oracle.com>
date: 2013-04-14 06:00:49

opt_gorder_clause was refactored not to use order_clause and
to collect information directly to select->gorder_list.
The ROLLUP protection code was duplicated from order_clause
to the new version of opt_gorder_clause.
2016-06-01 14:29:20 +04:00
Nirbhay Choubey
de7eafc7ce MDEV-6368: assertion xid_seqno > trx_sys_cur_xid_seqno
- Validate the specified wsrep_start_position value by also
checking the return status of wsrep->sst_received. This also
ensures that changes in wsrep_start_position is not allowed
when the node is not in JOINING state.
- Do not allow decrease in seqno within same UUID.
- The initial checkpoint in SEs should be [0...:-1].
2016-05-31 20:37:00 -04:00
Elena Stepanova
eb86c32225 Increase the version number 2016-05-30 00:13:57 +03:00
Elena Stepanova
7013f86e40 Follow-up for the previous commit - result change for a big test 2016-05-30 00:12:50 +03:00
Oleksandr Byelkin
7166069537 MDEV-3944: Allow derived tables in VIEWS 2016-05-28 14:44:21 +02:00
Alexander Barkov
1f89ea8ea0 sql_yacc.yy: Removing union_opt.
Using /*empty*/, union_list, union_order_or_limit instead.
This is to get rid of lex->current_select->braces easier
(separately in union_list and in union_order_or_limit)
2016-05-25 18:36:51 +04:00
Alexander Barkov
971538f4c2 Adding various tests for combinations of
UNION, ROLLUP, GROUP_CONCAT, for better coverage.
2016-05-25 11:00:06 +04:00
Alexander Barkov
2fc6e79084 Recording test results forgotten in 9a25c01f78
MDEV-10102 Disallow CREATE VIEW .. PROCEDURE ANALYSE() syntactically
2016-05-25 06:47:09 +04:00
Alexander Barkov
804b00e878 An sql_yacc.yy clean-up
- Moving opt_union_order_or_limit inside union_opt,
  as it's not used in other places any more.
- Changing union_opt to have no type.
  Earlier (before all MDEV-8909 dependency tasks) it had the <num> type,
  and it's return value was used to generate errors.
  Now union_opt does not need a return value because the grammar
  disallows ORDER and LIMIT clauses in wrong context.
2016-05-24 18:23:18 +04:00
Alexander Barkov
c80c3f6759 MDEV-10109 Disallow syntactically INSERT .. SELECT .. {ORDER BY ..| LIMIT ..} .. UNION .. 2016-05-24 18:05:38 +04:00
Alexander Barkov
ea9a393a86 MDEV-10103 Disallow syntactically UNION SELECT .. PROCEDURE ANALYSE() 2016-05-24 14:18:46 +04:00
Alexander Barkov
9a25c01f78 MDEV-10102 Disallow CREATE VIEW .. PROCEDURE ANALYSE() syntactically 2016-05-23 16:25:51 +04:00
Alexander Barkov
4c0e2960d4 MDEV-10051 Fix subselect to return a syntax error instead of "Incorrect usage of UNION and LIMIT" 2016-05-23 10:54:09 +04:00
Alexander Barkov
a999acf26e MDEV-10095 Fix derived tables to return a syntax error instead of "Illegal usage of UNION and LIMIT" 2016-05-21 16:52:12 +04:00
Alexander Barkov
349da1d643 sql_yacc.yy: Removing unnecessary init_nested_join() and end_nested_join()
from select_derived_init.
2016-05-21 00:27:57 +04:00
Alexander Barkov
c44b2e66a9 A derived_query_specification clean-up
(to simplify further MDEV-8909 changes)

1. Better semantic readability:
- Moving get_select_lex_derived inside select_derived_init
  and decomposing it into get_select_lex and
  $1->init_nested_join(lex->thd)
-  Moving DBUG_ASSERT($1 == Lex->current_select) inside
   select_derived_init

Now init_nested_join() and end_nested_join() reside inside
the same rule select_derived_init.
(It's very likely that they can be further removed,
 as there are no any joins in this rule).

3. Better grammar readability:
  Moving SELECT_SYM from select_derived_init to derived_query_specification.
  It's easier to read a rule when it starts from a terminal symbol.
2016-05-20 20:05:03 +04:00
Oleksandr Byelkin
485ece6da9 MDEV-8429: Change binlog_checksum default to match MySQL 5.6.6+ 2016-05-20 09:46:03 +02:00
Alexander Barkov
f6a7c1c75a MDEV-10080 Derived tables allow double LIMIT clause
1. Moving the "| get_select_lex_derived select_derived_init" part of
select_derived into a separate new rule derived_query_specification.
2. Using derived_query_specification directly in select_derived_union
rather than in select_derived.
3. Moving the sequence "opt_order_clause opt_limit_clause opt_select_lock_type"
from select_derived2 to select_derived_union,
after derived_query_specification.

Effectively, the parser now does not go through the sequence
"opt_order_clause opt_limit_clause ... opt_union_order_or_limit" any more.

This fixes the problem with double LIMIT clause and removes 2 shift/reduce
conflicts.
2016-05-20 09:21:07 +04:00
Alexander Barkov
c9629daa1e This patch is a cleanup simplifying upcoming
"MDEV-8909 union parser cleanup" changes.

When the server parses a query like
  SELECT * FROM (SELECT 1);
a sequence of calls
  st_select_lex::init_nested_join() ..
  st_select_lex::end_nested_join()
was performed two times (tested in gdb).
Both pairs of calls seem to be redundant for a query
like this, because there are actually no any joins here.

This patch moved "table_ref_select" inside "select_derived",
which revealed that one the pairs was definitely redundant:
After this transformation we got an init_nested_join()
immediately followed by end_nested_join() for the same st_select_lex,
which has no any sense. So this pair of calls was removed.
2016-05-19 18:57:23 +04:00
Oleksandr Byelkin
50a17de1ce MDEV-9947: COM_MULTI united response 2016-05-17 13:31:33 +02:00
Alexander Barkov
e7ff281d2e MDEV-6353 my_ismbchar() and my_mbcharlen() refactoring 2016-05-17 15:27:10 +04:00
Alexander Barkov
7e66a24dfb MDEV-10079 sql_yacc.yy: Remove non-parenthesized SELECT from table_ref 2016-05-17 13:41:39 +04:00
Alexander Barkov
971d777ac1 sql_yacc.yy: Adding a helper rule get_select_lex_derived,
to simplify further MDEV-8909 refactoring.
2016-05-17 11:18:59 +04:00
Alexander Barkov
c322e3fb4c MDEV-10078 sql_yacc.yy: Remove non-parenthesized SELECT from table_factor 2016-05-17 09:58:45 +04:00
Igor Babaev
a742f8e06b Merge branch '10.2' of github.com:MariaDB/server into 10.2 2016-05-16 20:19:48 -07:00
Igor Babaev
4a8d377171 Fixed bug mdev-10058.
This was a bug in the parser. As a result it could accept queries
with invalid derived tables if they used With clauses.
2016-05-16 20:19:04 -07:00
Alexander Barkov
1f4f7293fc sql_yacc.yy cleanup, to simplify further changes for MDEV-8909.
- Moving "SELECT_SYM select_init2_derived opt_table_expression"
  from query_term into a new separate rule query_specification,
  and using query_specification in the beginning of query_term.
- query_term now does not have a %type, query_specification has a %type
  instead. This removes duplicate code that returns
  Lex->current_select->master_unit()->first_select();
2016-05-16 14:50:21 +04:00
Vladislav Vaintroub
b79944950e attempt to fix debian build (gssapi plugins require 10.1 client or server instead of 10.2 2016-05-14 15:37:14 +00:00
Alexander Barkov
81b4c5335e sql_yacc.yy: adding a new rule union_head_non_top, to reuse some code
between select_derived_union and query_expression_body.
An upcoming patch for MDEV-10035 will also reuse union_head_non_top.
2016-05-13 16:26:07 +04:00
Oleksandr Byelkin
ba500853d1 Fix of PSI & COM_MULTI 2016-05-13 12:09:14 +02:00
Alexander Barkov
53775a97d7 sql_yacc.yy:
- Moving select_options_and_item_list from select_init2
  to select_init and view_select_aux
- Renaming select_init2 to select_init3
This will simplify upcoming sql_yacc.yy fixes (e.g. MDEV-10035, MDEV-8909).
2016-05-13 10:38:09 +04:00
Sergey Vojtovich
47a7c314ca close_open_tables() is not meaningful anymore 2016-05-10 16:18:03 +04:00
Sergey Vojtovich
1c68b9e9a4 MDEV-505 - feature request: add \H option for mysql client prompt
An addition to original patch:
- use FN_REFLEN instead of HOST_NAME_MAX (the latter can be undefined)
- avoid calling gethostname() on every prompt construction by caching it
2016-05-10 14:23:30 +04:00
Dan Ungureanu
eca060775e MDEV-505: feature request: add \H option for mysql client prompt
Introduce `\H` option which behaves mostly like `\h`. The only exception is
when the client connects to the server hosted on localhost. In this case, the
hostname will be used instead.
2016-05-10 13:40:35 +04:00
Alexander Barkov
f2afeb3826 Renaming query_specification to query_term, to make the sql_yacc.yy grammar
closer the grammar in the SQL Standard:
- <query specification> is only a SELECT followed by
  <set quantifier>, <select list> and <table expression>.
- While <query term> includes SELECT queries and derived tables.
2016-05-10 13:30:37 +04:00
Alexander Barkov
612267301f MDEV-10036 sql_yacc.yy: Split select_part2 to disallow syntactically bad constructs with INTO, PROCEDURE, UNION
MDEV-10037 UNION with LIMIT ROWS EXAMINED does not require parentheses
2016-05-10 11:48:01 +04:00
Alexander Barkov
c0a59b46be MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification
This change refactors the "table_expression" rule in sql_yacc.yy.

Queries with subselects and derived tables, as well as "CREATE TABLE ... SELECT"
now return syntax error instead of "Incorrect usage of PROCEDURE and ...".
2016-05-06 11:42:48 +04:00
Sergey Vojtovich
7905ea8904 MDEV-6720 - enable connection log in mysqltest by default
This is an addition to original patch. Removed meaningless
"echo SET SESSION AUTOCOMMIT=0" (transaction is started explicitely on
master anyway).
2016-05-05 11:20:37 +04:00
Monty
c788a13c64 Drop old not used mysql.ndb_binlog_index if exists 2016-05-01 19:10:51 +03:00
Monty
5a7374d71b Fixed test cases that broke because we now print changing of connections
- Don't log connection creation in galera_connect.inc
2016-05-01 19:10:13 +03:00
Sergei Golubchik
4f1c81de28 after-merge: simplify, fix a bug
* simplify the code at default: label
* bugfix: flush the checksum for NULL fields
  (perfschema.checksum was failing)
* cleanup: put repeated code into a function
2016-04-29 18:41:00 +02:00
Daniel Black
aed1485b99 MDEV-9758: correct test case 2016-04-29 18:41:00 +02:00
Daniel Black
84b0ac6721 Whitespace fix for mysql_checksum_table function 2016-04-29 18:41:00 +02:00
Daniel Black
1ba90cea25 MDEV-9758: correct checksum on non-continious blocks
Error noted by Sergey Vojtovich.
2016-04-29 18:41:00 +02:00
Daniel Black
51a66299f3 CHECKSUM TABLE to calculate in multiple column chunks
Checksum implementations contain optimizations for calculating
checksums of larger blocks of memory.

This optimization calls my_checksum on a larger block of memory
rather than calling on multiple adjacent memory as its going though
the table columns for each table row.
2016-04-29 18:41:00 +02:00