Commit graph

23738 commits

Author SHA1 Message Date
Sergei Petrunia
be00e279c6 MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE
Let range optimizer remove parts of OR-clauses for which range analysis
produced SEL_TREE(IMPOSSIBLE).
There is no need to remove parts of AND-clauses: either they are inside
of OR (and the whole AND-clause will be removed), or the AND-clause is
at the top level, in which case the whole WHERE (or ON) is always FALSE
and this is a degenerate case which receives special treatment.

The removal process takes care not to produce 1-way ORs (in that case
we substitute the OR for its remaining member).
2014-08-27 18:47:33 +04:00
Sergei Petrunia
9534fd83ce MDEV-6634: Wrong estimates for ref(const): Update test result 2014-08-26 16:24:40 +04:00
Sergei Petrunia
378878e1e9 MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate
IS [NOT] NULL predicate is sargable within an outer join. Range
analysis only uses predicates from ON expressions, which have
regular semantics (without null-complemented rows, etc).
There is no reason not use IS [NOT] NULL predicates.
2014-08-24 12:36:51 +04:00
Monty
e2b2bde358 Made sql_log_slow a session variable
mysqldump:
- Added --log-queries to allow one to disable logging for the dump

sql/log_event.cc:
- Removed setting of enable_slow_log as it's not required anymore.

sql/sql_parse.cc:
- Set enable_slow_log to value of thd->variables.sql_log_slow as this will speed up tests if slow log is disabled.
- opt_log_slow_admin_statements can now only disable slow log, not enable it.

sql/sql_explain.cc:
- Minor cleanup

Other things:
- Added sql_log_slow to system variables.
- Changed opt_slow_log to global_system_variables.sql_log_slow in all files
- Updated tests to reflect changes
2014-08-09 13:22:01 +03:00
Sergei Golubchik
911c4811de cleanup and updated test results 2014-07-23 14:48:13 +02:00
Vicentiu Ciorbaru
64b27c734e Added default role implementation 2014-07-23 14:48:12 +02:00
Oleksandr Byelkin
01046e7f92 RBR triggers enabling in 10.1 2014-07-02 16:18:28 +03:00
Sergei Petrunia
3d7eeb6307 MDEV-6394: ANALYZE DELETE .. RETURNING fails with ERROR 2027 Malformed packet
- Add support for DELETE .. RETURNING statement in ANALYZE code.
2014-06-26 22:03:13 +04:00
Sergei Petrunia
be885ebe8c Code cleanup, more tests. 2014-06-26 20:12:18 +04:00
Sergei Petrunia
c6be74458f MDEV-6398: ANALYZE UPDATE does not populate r_rows
- In print_explain_row(), do not forget to print r_rows.
- Switch Explain_update from using its own counters to re-using
  Table_access_tracker.
- Make ANALYZE UPDATE code structure uniform with ANALYZE DELETE.
2014-06-26 19:09:23 +04:00
Sergei Petrunia
a787edd7e6 MDEV-6395: Make ANALYZE UPDATE/DELETE handle the degenerate query plans. 2014-06-26 18:32:18 +04:00
Sergei Petrunia
12d6f89b07 MDEV-6393: ANALYZE SELECT crashes ... Don't try printing EXPLAIN if we had an error. 2014-06-26 15:55:25 +04:00
Sergei Petrunia
18d5a748f1 MDEV-406: ANALYZE $stmt: Make multi-table UPDATE/DELETE work, code cleanup. 2014-06-26 01:22:50 +04:00
Sergei Petrunia
3da81ab97f MDEV-406: ANALYZE $stmt: more testcases, fix memory leak 2014-06-25 18:35:30 +04:00
Sergei Petrunia
424d5de89d Merge bb-10.1-explain-analyze into 10.1 2014-06-25 16:46:42 +04:00
Sergei Petrunia
b561a98a87 MDEV-406: ANALYZE $stmt: add some tests for joins 2014-06-25 16:01:09 +04:00
Sergei Petrunia
7711999d8b MDEV-406: ANALYZE $stmt: add support for BNL join buffering 2014-06-25 15:15:38 +04:00
Sergei Petrunia
c3cfb6910a MDEV-406: ANALYZE $stmt: Scans that never executed will have r_rows=NULL 2014-06-24 23:58:13 +04:00
Sergei Petrunia
c08de06246 MDEV-406: ANALYZE $stmt: get ANALYZE work for subqueries
- "ANALYZE $stmt" should discard select's output, but it should still
  evaluate the output columns (otherwise, subqueries in select list
  are not executed)
- SHOW EXPLAIN's code practice of calling JOIN::save_explain_data()
  after JOIN::exec() is disastrous for ANALYZE, because it resets
  all counters after the first execution. It is stopped
  = "Late" test_if_skip_sort_order() calls explicitly update their part
    of the query plan.
  = Also, I had to rewrite I_S optimization to actually have optimization
    and execution stages.
2014-06-24 19:41:43 +04:00
Sergei Golubchik
242e7f958d MDEV-4549 [PATCH] Clean up code working with ACL tables
* enum values to index different ACL tables, instead of hard-coded numbers
  (even different in diffent functions).
* move TABLE_LIST initialization into open_grant_tables()
  and use it everywhere
* change few my_bool's to bool's
2014-06-23 16:23:51 +02:00
Sergei Golubchik
ce6a63ec41 MDEV-4260 Don't create frm files for temporary tables
* Don't write frm for tmp tables
* pass frm image down to open_table_uncached, when possible
* don't use truncate-by-recreate for temp tables - cannot recreate
  without frm, and delete_all_rows is faster anyway
2014-06-20 15:47:44 +02:00
Sergei Golubchik
dc64ba2187 MDEV-6137 better help for SET/ENUM sysvars
Auto-generate the allowed list of values for enum/set/flagset options
in --help output. But don't do that when the help text already has them.

Also, remove lists of values from help strings of various options, where
they were simply listed without any additional information.
2014-06-19 12:02:23 +02:00
Sergei Petrunia
581b889771 Update analyze_stmt.result after the last commit 2014-06-16 13:34:03 +04:00
Sergei Golubchik
cf1a09e42f MDEV-6107 merge default_tmp_storage_engine
Adapt default_tmp_storage_engine implementation from mysql-5.6
New feature (as compared to 5.6), default_tmp_storage_engine=NULL
means that temporary tables will use default_storage_engine value.
This makes the behavior backward compatible.
2014-06-15 18:42:31 +02:00
Sergei Golubchik
f61f36b386 Merge branch '10.0' into 10.1
Conflicts:
	CMakeLists.txt
	VERSION
Modified:
	.gitignore
2014-06-13 16:10:25 +02:00
Sergei Golubchik
3d4dbe4d94 avoid uppercase table aliases tests - they're not portable 2014-06-11 19:08:06 +02:00
Sergei Golubchik
1eaf2106e5 MDEV-6253 MySQL Users Break when Migrating from MySQL 5.1 to MariaDB 10.0.10
When plugin=mysql_native_password (or mysql_old_password) take the password
from *either* password *or* authentication_string, whichever is set.
This makes no sense, but alas, that's what MySQL-5.6 does.
2014-06-11 10:09:29 +02:00
Sergei Golubchik
6e8d49b8f5 MDEV-6065 MySQL Bug#13623473 "MISSING ROWS ON SELECT AND JOIN WITH TIME/DATETIME COMPARE"
fix for ref like "indexed_time = datetime"
2014-06-11 10:08:08 +02:00
Sergei Golubchik
dc9b2a95bf MDEV-6249 mark P_S STABLE and disable it by default 2014-06-09 20:00:23 +02:00
Igor Babaev
2436d58e19 Merge 2014-06-10 15:32:56 -07:00
Sergey Petrunya
02720fd7ac Merge 2014-06-10 21:51:02 +02:00
Sergey Petrunya
b80a02cbc4 Merge 2014-06-10 21:46:27 +02:00
Igor Babaev
1f7e68044c Merge. 2014-06-10 12:45:20 -07:00
Igor Babaev
d42e6d3a99 Fixed bug mdev-6071.
The method JOIN_CACHE::init may fail (return 1) if some conditions on the
used join buffer is not satisfied. For example it fails if join_buffer_size
is greater than join_buffer_space_limit. The conditions should be checked
when running the EXPLAIN command for the query. That's why the method
JOIN_CACHE::init has to be called for EXPLAIN commands as well.
2014-06-10 10:34:58 -07:00
Alexey Botchkov
6b84ecdc37 MDEV-4440 IF NOT EXISTS in multi-action ALTER does not work when the problem is created by a previous part of the ALTER.
Loops added to the handle_if_exists_option() to check the
        CREATE/DROP lists for duplicates.
2014-06-10 17:02:46 +05:00
Sergey Petrunya
aeb62282a2 MDEV-5985: EITS: selectivity estimates look illogical for join and non-key equalities
Part#1. 

table_cond_selectivity() should discount selectivity of table' 
conditions only when ity counts that selectivity to begin with. 

For non-ref-based access methods (ALL/range/index_merge/etc),
we start with sel=1.0 and hence do not need to discount any
selectivities.
2014-06-10 12:25:16 +02:00
unknown
b1886e2bff merge of MDEV-6047 2014-06-09 13:47:20 +03:00
unknown
4cd676cbd9 MDEV-6047: Make exists_to_in optimization ON by default 2014-06-09 13:42:21 +03:00
Sergey Petrunya
349e31d5a7 Merge 2014-06-07 23:45:05 +02:00
Sergey Petrunya
71df035551 MDEV-6308: Server crashes in table_multi_eq_cond_selectivity with ...
- In table_cond_selectivity(), reset keyuse variable between the loops.
2014-06-07 19:00:26 +02:00
Alexander Barkov
216fbe2af3 MDEV-6102 Comparison between TIME and DATETIME does not use CURRENT_DATE
MDEV-6101 Hybrid functions do not add CURRENT_DATE when converting TIME to DATETIME
2014-06-06 10:29:52 +04:00
Sergei Golubchik
e27c338634 5.5.38 merge 2014-06-06 00:07:27 +02:00
Sergei Golubchik
6d75570e99 fix range.test 2014-06-05 19:25:51 +02:00
Sergey Petrunya
c7e5a1f70d MDEV-6105: Emoji unicode character string search query makes mariadb performance down
- When range optimizer cannot the lookup value into [VAR]CHAR(n) column,
  it should produce:
  = "Impossible range" for equality
  = "no range" for non-equalities.
2014-06-05 19:18:35 +04:00
Sergei Golubchik
2d2697ea8d MDEV-6221 SQL_CALC_FOUND_ROWS yields wrong result again
replace another old "was there a filesort?" test with
a correct "did filesort calculate found_rows?" test.
2014-06-05 15:59:46 +02:00
Sergei Golubchik
fde6ee61bb revert the fix for MDEV-5898, restore the fix for MDEV-5549.
simplify test case for MDEV-5898
2014-06-05 15:59:41 +02:00
Sergei Golubchik
37d353770f MDEV-5998 MySQL Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS DATABASE SECURITY
Merge from mysql-5.6:
revno: 3257
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
branch nick: mysql-trunk-bug11756966
timestamp: Thu 2011-07-14 09:32:01 +0200
message:
  Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
                 DATABASE SECURITY

  The problem was that CREATE PROCEDURE/FUCTION could be used to
  check the existence of databases for which the user had no
  privileges and therefore should not be allowed to see.

  The reason was that existence of a given database was checked
  before privileges. So trying to create a stored routine in
  a non-existent database would give a different error than trying
  to create a stored routine in a restricted database.

  This patch fixes the problem by changing the order of the checks
  for CREATE PROCEDURE/FUNCTION so that privileges are checked first.
  This means that trying to create a stored routine in a
  non-existent database and in a restricted database both will
  give ER_DBACCESS_DENIED_ERROR error.

  Test case added to grant.test.
2014-06-05 15:59:35 +02:00
Alexander Barkov
284479c085 Merge 5.3->5.5 2014-06-04 21:53:15 +04:00
Alexander Barkov
661daf16f1 MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column
MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND)
MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME)
MDEV-6100 No warning on CAST(9000000 AS TIME)
2014-06-04 20:32:57 +04:00
unknown
113333d447 MDEV-6046: MySQL Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND 2014-06-04 13:03:55 +03:00