Commit graph

48 commits

Author SHA1 Message Date
unknown
8efc63ba5d Merge 2012-06-06 16:19:48 +03:00
Sergei Golubchik
265d5aaa2e MDEV-308 lp:1008516 - Failing assertion: templ->mysql_col_len == len
remove the offending assert.
take the test case from mysql Bug#58015
2012-06-04 23:22:03 +02:00
Sergei Golubchik
3e3606d21d merge with 5.3.
Take only test cases from MDEV-136 Non-blocking "set read_only"
2012-06-04 17:26:11 +02:00
Sergey Petrunya
8978675b33 BUG#1000051: Query with simple join and ORDER BY takes thousands times longer when run with ICP
- Correct testcases.
2012-05-23 11:55:14 +04:00
Sergey Petrunya
1d3ba8a791 BUG#1000051: Query with simple join and ORDER BY takes thousands times longer when run with ICP
- Disable IndexConditionPushdown for reverse scans.
2012-05-23 11:46:40 +04:00
Sergei Golubchik
580eca69ae typo fixed: space in the status variable name 2012-04-17 20:25:03 +02:00
Sergey Petrunya
567d871ff0 Don't run test for BUG#933412 with embedded server, as it requires concurrent query
execution which mtr --embedded does not support
2012-02-22 17:38:24 +04:00
unknown
c299e027ee Changed names of statistic variables and counting matches instaed of rejected rows. 2012-02-22 10:38:28 +02:00
Sergey Petrunya
c381e44050 BUG#933412: Server crashes in _mi_put_key_in_record on KILL QUERY with ICP, STRAIGHT_JOIN
- In mi_rkey(), do correct handling of case where mi_yield_and_check_if_killed() 
  detects that the thread was killed (all other similar functions in MyISAM/Aria have 
  slightly different code and do not have this problem).
- Also fixed assignment in DBUG_ASSERT
- this is 2nd variant of the fix:
   = make .result file smaller
   = run KILLable statements in a separate connection, otherwise we could end up trying to 
     KILL the final "DROP TABLE" statement
2012-02-20 20:38:05 +04:00
unknown
607aab9c1d Counters for Index Condition Pushdown added (MDEV-130). 2012-02-16 08:49:10 +02:00
Sergei Golubchik
3f28115e0e 5.3 merge 2012-02-24 14:37:00 +01:00
Sergei Golubchik
edab37cd68 5.3 merge 2012-02-21 20:51:56 +01:00
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Igor Babaev
2b1f0b8757 Back-ported the patch of the mysql-5.6 code line that
fixed several defects in the greedy optimization:

1) The greedy optimizer calculated the 'compare-cost' (CPU-cost)
   for iterating over the partial plan result at each level in
   the query plan as 'record_count / (double) TIME_FOR_COMPARE'

   This cost was only used locally for 'best' calculation at each
   level, and *not* accumulated into the total cost for the query plan.

   This fix added the 'CPU-cost' of processing 'current_record_count'
   records at each level to 'current_read_time' *before* it is used as
   'accumulated cost' argument to recursive 
   best_extension_by_limited_search() calls. This ensured that the
   cost of a huge join-fanout early in the QEP was correctly
   reflected in the cost of the final QEP.

   To get identical cost for a 'best' optimized query and a
   straight_join with the same join order, the same change was also
   applied to optimize_straight_join() and get_partial_join_cost()

2) Furthermore to get equal cost for 'best' optimized query and a
   straight_join the new code substrcated the same '0.001' in
   optimize_straight_join() as it had been already done in
   best_extension_by_limited_search()

3) When best_extension_by_limited_search() aggregated the 'best' plan a
   plan was 'best' by the check :

   'if ((search_depth == 1) || (current_read_time < join->best_read))'

   The term '(search_depth == 1' incorrectly caused a new best plan to be
   collected whenever the specified 'search_depth' was reached - even if
   this partial query plan was more expensive than what we had already
   found.
2011-12-24 08:55:10 -08:00
Igor Babaev
7a1406f229 Fixed LP bug #904832.
Do not perform index condition pushdown for conditions containing subqueries
and stored functions.
2011-12-18 23:38:37 -08:00
Igor Babaev
f5dac20f38 Made the optimizer switch flags 'outer_join_with_cache', 'semijoin_with_cache'
set to 'on' by default.
2011-12-15 00:21:15 -08:00
Sergey Petrunya
255fd6c929 Make subquery Materialization, as well as semi-join Materialization be shown
in EXPLAIN as select_type==MATERIALIZED. 

Before, we had select_type==SUBQUERY and it was difficult to tell materialized
subqueries from uncorrelated scalar-context subqueries.
2011-12-05 01:31:42 +04:00
Sergei Golubchik
effed09bd7 5.3->5.5 merge 2011-11-27 17:46:20 +01:00
Sergei Golubchik
d2755a2c9c 5.3->5.5 merge 2011-11-22 18:04:38 +01:00
unknown
f0d9908fc3 Merge enabling of materialization=on by default with main tree. 2011-11-21 16:56:32 +02:00
Igor Babaev
b91a6bd88b Fixed LP bug #879871.
The function add_ref_to_table_cond missed updating the value of
join_tab->pre_idx_push_select_cond after having updated the value
of join_tab->select->pre_idx_push_select_cond.
2011-11-11 14:53:26 -08:00
Sergey Petrunya
7c7611d728 BUG#887026: Wrong result with ICP, outer join, subquery in maria-5.3-icp
- Do not push index condition if we're using a triggered ref access.
2011-11-07 23:30:03 +04:00
Igor Babaev
e0c1b3f242 Fixed LP bug #886145.
The bug happened because in some cases the function JOIN::exec
did not save the value of TABLE::pre_idx_push_select_cond in
TABLE::select->pre_idx_push_select_cond for the sort table.

Noticed and fixed a bug in the function make_cond_remainder
that builds the remainder condition after extraction of an index
pushdown condition from the where condition. The code
erroneously assumed that the function make_cond_for_table left
the value of ICP_COND_USES_INDEX_ONLY in sub-condition markers.
Adjusted many result files from the regression test suite
after this fix .
2011-11-06 01:23:03 -07:00
Igor Babaev
928e94fb98 Fixed LP bug #885168.
The call of the virtual function cancel_pushed_idx_cond in the code of
the function test_if_skip_sort_order was misplaced when backporting the
fix for bug 58816.
2011-11-04 05:39:45 -07:00
Igor Babaev
a70f7aa5fe Backported the fix and the test case for bug 12822678 from the mysql-5.6 code line.
Fixed a bug in select_describe.
Adjusted results for affected test cases.
2011-11-01 07:00:55 -07:00
Igor Babaev
3a7169572c Backported the test case for bug 59843 from the mysql-5.6 code line.
(Failed to reproduce the bug in mariadb-5.3).
2011-10-31 01:13:12 -07:00
Igor Babaev
7dd42686fe Backported the fix and the test case for bug 59483 from the mysql-5.6 code line. 2011-10-30 06:17:07 -07:00
Igor Babaev
e5627c9802 Backported the test case for bug 58838 from mysql-5.6 code line.
The bug was fixed by the patches for LP bugs 668644,702322 that
were applied earlier to the mariadb-5.3 code.
2011-10-30 04:18:09 -07:00
Igor Babaev
c118219f38 Backported the test case for bug 59186 from mysql-5.6 code line.
The bug was fixed by the patch for LP bug 694092 that was
applied earlier to the mariadb-5.3 code.
2011-10-30 03:34:26 -07:00
Igor Babaev
4cf3cb7240 Backported the test case for bug 58837. The fix was backported earlier. 2011-10-30 02:37:10 -07:00
Igor Babaev
7bc6a83b02 Backported the fix and the test case for bug #58816 from mysql-5.6 code line. 2011-10-29 15:36:24 -07:00
Igor Babaev
a8f5b5e866 Merge. 2011-10-28 05:19:45 -07:00
Igor Babaev
4b4dfd57f5 Merge. 2011-10-28 04:07:11 -07:00
Sergey Petrunya
3694bb90a4 - Let t/myisam_icp.test run include/icp_tests.inc with MRR/ICP turned ON (not OFF)
- Fix the compile-time-default value of optimizer_switch printed by mysqld --help --defaults
2011-10-28 12:38:36 +04:00
Igor Babaev
8feff690b6 Fixed LP bug #870046.
This bug is a consequence of the fix in the function add_ref_to_table_cond
for LP bug 826935 that turned out to be not quite correct: it tried to AND
the same generated condition with two different other conditions.
This patch creates a copy of the generated condition if the condition needs
to be ANDed with two different items.
2011-10-11 02:36:08 -07:00
Sergey Petrunya
e4bb53341f BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
- add_ref_to_table_cond() should not just overwrite pre_idx_push_select_cond
  with the contents tab->select_cond.
  pre_idx_push_select_cond exists precisely for the reason that it may contain
  a condition that is a strict superset of what is in tab->select_cond. 
  The fix is to inject generated equality into pre_idx_push_select_cond.
2011-08-17 11:57:01 +04:00
Sergey Petrunya
2a9c86be26 BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
- Make {ha_myisam,ha_maria}::index_read_idx_map check pushed index condition.
- Address review feedback (added comments)
2011-07-14 17:44:37 +04:00
Sergey Petrunya
1492de8563 Set the default to be mrr=off,mrr_sort_keys=off:
- Set the default
- Adjust the testcases so that 'new' tests are run with optimizations turned on.
- Pull out relevant tests from "irrelevant" tests and run them with optimizations on.
- Run range.test and innodb.test with both mrr=on and mrr=off
2011-07-08 18:46:47 +04:00
Igor Babaev
37f3a801f3 Backported the test case for bug 52605. 2011-05-29 11:09:05 -07:00
Igor Babaev
061060eac0 Backported the test case for bug 52660 from mysql code line.
Extended the test case to show how MariaDB applies ICP for
indexes with some components defined on the beginning of fields.
2011-05-27 20:50:06 -07:00
Igor Babaev
42cc59a8c1 Backported the test case for bug 43618 from mysql code line. 2011-05-27 17:04:29 -07:00
Igor Babaev
d86ad1861a Backported the test case for bug 43617 fixed by the patch for bug 42580.
Backported the test case for bug 49906 fixed by the patch for LP bug 625841.
Slightly optimized the code of the fix for LP bug 625841.
2011-05-27 15:20:19 -07:00
Igor Babaev
deb3b9a174 Downported InnoDB support of Index Condition Pushdown from MySQL-5.6 code line. 2011-05-25 16:01:56 -07:00
Michael Widenius
2813f568b7 Merge with bugfix
sql/multi_range_read.cc:
  Added printing of error if something goes wrong in get_next()
  (Not critical for this bug fix, but this was something that I noticed while testing and found missing)
storage/myisam/mi_rkey.c:
  Fixed wrong error number in mi_yield_and_check_if_killed()
2011-02-18 21:45:32 +02:00
Michael Widenius
b12e3796dc Fix for lp:711565 "Index Condition Pushdown can make a thread hold MyISAM locks as well as be unKILLable for long time"
- In Maria/MyISAM: Release/re-acquire locks to give queries that wait on them a chance to make progress
- In Maria/MyISAM: Change from numeric constants to ICP_RES values.
- In Maria: Do check index condition in maria_rprev() (was lost in the merge/backport?)
- In Maria/MyISAM/XtraDB: Check if the query was killed, and return immediately if it was.

Added new storage engine error: HA_ERR_ABORTED_BY_USER, for handler to signal that it detected a kill of the query and aborted

Authors: Sergey Petrunia & Monty

include/my_base.h:
  Added HA_ERR_ABORTED_BY_USER, for handler to signal that it detected a kill of the query and aborted
include/my_handler.h:
  Added comment
mysql-test/r/myisam_icp.result:
  Updated test
mysql-test/t/myisam_icp.test:
  Drop used tables at start of test
  Added test case that can help with manual testing of killing index condition pushdown query.
mysys/my_handler_errors.h:
  Text for new storage engine error
sql/handler.cc:
  If engine got HA_ERR_ABORTED_BY_USER, send kill message.
sql/multi_range_read.cc:
  Return error code
storage/maria/ha_maria.cc:
  Added ma_killed_in_mariadb() to detect kill.
  Ensure that file->external_ref points to TABLE object.
storage/maria/ma_extra.c:
  Dummy test-if-killed for standalone
storage/maria/ma_key.c:
  If ma_check_index_cond() fails, set my_errno and info->cur_row.lastpos
storage/maria/ma_rkey.c:
  Release/re-acquire locks to give queries that wait on them a chance to make progress
  Check if the query was killed, and return immediately if it was
storage/maria/ma_rnext.c:
  Check if the query was killed, and return immediately if it was
  Added missing fast_ma_writeinfo(info)
storage/maria/ma_rnext_same.c:
  Check if the query was killed, and return immediately if it was
  Added missing fast_ma_writeinfo(info)
storage/maria/ma_rprev.c:
  Check if the query was killed, and return immediately if it was
  Added missing fast_ma_writeinfo(info) and ma_check_index_cond()
storage/maria/ma_search.c:
  Give error message if we find a wrong key
storage/maria/ma_static.c:
  Added pointer to test-if-killed function
storage/maria/maria_def.h:
  New prototypes
storage/myisam/ha_myisam.cc:
  Added mi_killed_in_mariadb()
  Ensure that file->external_ref points to TABLE object.
storage/myisam/mi_extra.c:
  Dummy test-if-killed for standalone
storage/myisam/mi_key.c:
  If ma_check_index_cond() fails, set my_errno and info->lastpos
storage/myisam/mi_rkey.c:
  Ensure that info->lastpos= HA_OFFSET_ERROR in case of error
  Release/re-acquire locks to give queries that wait on them a chance to make progress
  Check if the query was killed, and return immediately if it was
  Reorder code to do less things in case of error.
  Added missing fast_mi_writeinfo()
storage/myisam/mi_rnext.c:
  Check if the query was killed, and return immediately if it was
  Simplify old ICP code
  Added missing fast_ma_writeinfo(info)
storage/myisam/mi_rnext_same.c:
  Check if the query was killed, and return immediately if it was
  Added missing fast_mi_writeinfo(info)
storage/myisam/mi_rprev.c:
  Check if the query was killed, and return immediately if it was
  Simplify error handling of ICP
  Added missing fast_mi_writeinfo(info)
storage/myisam/mi_search.c:
  Give error message if we find a wrong key
storage/myisam/mi_static.c:
  Added pointer to test-if-killed function
storage/myisam/myisamdef.h:
  New prototypes
storage/xtradb/handler/ha_innodb.cc:
  Added DB_SEARCH_ABORTED_BY_USER and ha_innobase::is_thd_killed()
  Check if the query was killed, and return immediately if it was
storage/xtradb/handler/ha_innodb.h:
  Added prototype
storage/xtradb/include/db0err.h:
  Added DB_SEARCH_ABORTED_BY_USER
storage/xtradb/include/row0mysql.h:
  Added possible ICP errors
storage/xtradb/row/row0sel.c:
  Use ICP errors instead of constants.
  Detect if killed and return B_SEARCH_ABORTED_BY_USER
2011-02-18 17:43:59 +02:00
Igor Babaev
777b6b8ccb Backported test case for bug #36981. 2011-02-08 19:17:12 -08:00
Sergey Petrunya
2d9f69334f Backport of:
3150 Olav Sandstaa     2010-05-07
Test cases for the following "ICP for InnoDB" bugs:

Bug#40992 InnoDB: Crash when engine_condition_pushdown is on
Bug#35080 Innodb crash at mem_block_get_len line 72
Bug#41996 multi-table delete crashes server (InnoDB table)
Bug#43448 Server crashes on multi table delete with Innodb

All these bugs are duplicates of either one or both of Bug 43360 or 36981.

(backporting of olav@sun.com-20100226091930-qxvakxmcp6463t5w)
2011-01-14 17:30:27 +03:00
Sergey Petrunya
d0535d80a1 Test case backport for: Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for null-safe operator <=> NULL 2011-01-14 16:38:41 +03:00