Commit graph

1075 commits

Author SHA1 Message Date
Sergey Petrunya
e5d13c1567 Merge 10.0-base -> 10.0 2013-10-16 13:38:42 +04:00
Sergey Petrunya
1e36cbfa39 MDEV-3798: [SHOW] EXPLAIN UPDATE/DELETE
- Merge with 10.0-base
2013-10-15 11:51:41 +04:00
Sergey Petrunya
69e6a2bb22 MDEV-3798: EXPLAIN UPDATE/DELETE
- Update test results after last few csets
- Generate correct value for `possible_keys` column for single table UPDATE/DELETE.
2013-10-08 16:13:49 +04:00
Sergey Petrunya
69393db3d1 MDEV-3798: EXPLAIN UPDATE/DELETE
- Better EXPLAIN-saving methods for quick selects
2013-10-07 13:58:47 +04:00
Sergey Petrunya
72bc6d7364 MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: more renames
2013-10-05 13:19:45 +04:00
Sergey Petrunya
fedf769f0b MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: rename nearly any name used by the new EXPLAIN code.
2013-10-05 09:58:22 +04:00
Sergey Petrunya
0b69c44e94 MDEV-5067: Valgrind warnings (Invalid read) in QPF_table_access::print_explain
- Query plan footprint (in new terms, "EXPLAIN structure") should always keep 
  a copy of key_name.  This is because the table might be a temporary table which
  may be already freed by the time we use query plan footprint.
2013-09-26 14:42:30 +04:00
Sergei Golubchik
9af177042e 10.0-base merge.
Partitioning/InnoDB changes are *not* merged (they'll come from 5.6)
TokuDB does not compile (not updated to 10.0 SE API)
2013-09-21 10:14:42 +02:00
Sergei Golubchik
4ec2e9d7ed 5.5 merge and fixes for compiler/test errors 2013-09-18 13:07:31 +02:00
Sergey Petrunya
abf4a910f2 [SHOW] EXPLAIN UPDATE/DELETE
- Make QPF structures store data members, not strings. 
  This is not fully possible, because table names (and hence 
  key names, etc) can be deleted, and we have to store strings.
2013-09-17 15:01:34 +04:00
Sergei Golubchik
9c98876ca1 tokudb patches for prepare range scan 2013-09-09 14:00:18 +02:00
unknown
33c66eb7fb MDEV-4120: UNIQUE indexes should not be considered for loose index scan
Currently the loose scan code in opt_range.cc considers all indexes as
possible for the access method. Due to inexact statistics it may happen
that a loose scan is selected over a unique index.
  
This is clearly wrong since a "loose scan" over a unique index will read
the same keys as a direct index scan, but the loose scan has more overhead.
  
This task adds a rule to skip unique indexes for loose scan.
2013-08-21 10:51:08 +03:00
Igor Babaev
9d1f31fb4b Fixed a valgrind warning:
reverted the change done for WL 4443.
2013-08-05 13:52:53 -07:00
Igor Babaev
507410379a Fixed a wrong merge in prune_partitions()
Added forgotten partition_explicit_prune from mysql-5.6.

Backported the fix for
Bug#13559657: PARTITION SELECTION DOES NOT WORK WITH VIEWS
from mysql-5.6
2013-07-31 06:45:44 -07:00
Sergei Golubchik
b7b5f6f1ab 10.0-monty merge
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
2013-07-21 16:39:19 +02:00
Sergei Golubchik
5f6380adde 10.0-base merge 2013-07-18 16:46:57 +02:00
Sergei Golubchik
97e640b9ae 5.5 merge 2013-07-17 21:24:29 +02:00
unknown
66ec79fc87 Fix for MDEV-4219 A simple select query returns random data (upstream bug#68473)
In the case of loose scan used as input for order by, end_send()
didn't detect correctly that a loose scan was used, and didn't copy
the non-aggregated fields from the temp table used for ORDER BY.
  
The fix uses the fact that the quick select used for sorting is
attached to JOIN::pre_sort_join_tab instead of JOIN::join_tab.
2013-07-17 16:42:13 +03:00
Sergei Golubchik
005c7e5421 mysql-5.5.32 merge 2013-07-16 19:09:54 +02:00
Sergey Petrunya
a0de3e0485 MDEV-4556 Server crashes in SEL_ARG::rb_insert with index_merge+index_merge_sort_union, FORCE INDEX
- merge_same_index_scans() may put the same SEL_ARG tree in multiple result plans.
  make it call incr_refs() on the SEL_ARG trees that it does key_or() on, because 
  key_or(sel_arg_tree_1, sel_arg_tree_2) call may invalidate SEL_ARG trees pointed 
  by sel_arg_tree_1 and sel_arg_tree_2.
2013-07-11 15:12:50 +04:00
Alexander Barkov
5b0774ee1c Adding support for MySQL-5.6 temporal column types:
TIME, DATETIME, TIMESTAMP


added:
  mysql-test/r/type_temporal_mysql56.result
  mysql-test/std_data/mysql56datetime.MYD
  mysql-test/std_data/mysql56datetime.MYI
  mysql-test/std_data/mysql56datetime.frm
  mysql-test/std_data/mysql56time.MYD
  mysql-test/std_data/mysql56time.MYI
  mysql-test/std_data/mysql56time.frm
  mysql-test/std_data/mysql56timestamp.MYD
  mysql-test/std_data/mysql56timestamp.MYI
  mysql-test/std_data/mysql56timestamp.frm
  mysql-test/suite/rpl/r/rpl_temporal_mysql56.result
  mysql-test/suite/rpl/t/rpl_temporal_mysql56.test
  mysql-test/t/type_temporal_mysql56.test
  sql/compat56.cc
  sql/compat56.h
modified:
  client/mysqlbinlog.cc
  include/my_time.h
  include/mysql.h.pp
  include/mysql_com.h
  mysql-test/r/statistics.result
  mysql-test/r/strict.result
  mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
  mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
  sql-common/my_time.c
  sql/CMakeLists.txt
  sql/field.cc
  sql/field.h
  sql/item.cc
  sql/item_strfunc.cc
  sql/item_sum.cc
  sql/item_timefunc.cc
  sql/log_event.cc
  sql/opt_range.cc
  sql/opt_table_elimination.cc
  sql/protocol.cc
  sql/rpl_utility.cc
  sql/rpl_utility.h
  sql/sql_partition.cc
  sql/sql_prepare.cc
  sql/sql_select.cc
  sql/sql_table.cc
  sql/table.cc
  storage/perfschema/pfs_engine_table.cc
2013-07-10 11:49:17 +04:00
Sergei Golubchik
935817e985 Fix to compile without partitioning.
Remove few ifdef's
2013-06-15 19:09:40 +02:00
Michael Widenius
5f1f2fc0e4 Applied all changes from Igor and Sanja 2013-06-15 18:32:08 +03:00
Sergei Golubchik
72ba95873a 10.0-base merge
(without InnoDB - all InnoDB changes were ignored)
2013-06-06 21:32:29 +02:00
Sergei Golubchik
4749d40c63 5.5 merge 2013-06-06 17:51:28 +02:00
Michael Widenius
bef95a4bbe -Run test suite with smaller aria keybuffer size (to make it possible to run more tests in parallel)
-Added test and extra code to ensure we don't leave keyread on for a handler table.
-Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G.

mysql-test/include/default_mysqld.cnf:
  Run test suite with smaller aria keybuffer size
mysql-test/suite/maria/maria3.result:
  Run test suite with smaller aria keybuffer size
mysql-test/suite/sys_vars/r/aria_pagecache_buffer_size_basic.result:
  Run test suite with smaller aria keybuffer size
sql/handler.cc:
  Disable key read (extra safety if something went wrong)
sql/multi_range_read.cc:
  Ensure we have don't leave keyread on for secondary_file
sql/opt_range.cc:
  Simplify code with mark_columns_used_by_index_no_reset()
  Ensure that read_keys_and_merge() disableds keyread if it enables it
sql/opt_subselect.cc:
  Remove not anymore used argument for create_internal_tmp_table()
sql/sql_derived.cc:
  Remove not anymore used argument for create_internal_tmp_table()
sql/sql_select.cc:
  Use 'enable_keyread()' instead of calling HA_EXTRA_RESET. (Makes debugging easier)
  Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G.
  Remove not anymore used argument for create_internal_tmp_table()
  More DBUG
sql/sql_select.h:
  Remove not anymore used argument for create_internal_tmp_table()
2013-06-05 23:53:35 +03:00
unknown
a0fd7382bc Merge 10.0-base -> 10.0 2013-05-28 15:39:56 +02:00
Michael Widenius
3143ad589a Push a lot of small fixes to get larger parts to compile 2013-05-21 22:00:08 +03:00
Alexey Botchkov
c2ee0218ba MDEV-4521 MBRContains, MBRWithin no longer work with geometries of different type.
get_mm_leaf function can store all sorts of spatial features in
        one type of field it receives from an Item_field.
        So we just allow that by setting the type of this field to GEOMETRY.

per-file comments:
  mysql-test/r/gis-rtree.result
        result updated
  mysql-test/t/gis-rtree.test
        test case added.
  sql/opt_range.cc
        set geom_type=GEOMETRY if we got Field_geom.
2013-05-15 02:33:29 +05:00
Sergei Golubchik
b381cf843c mysql-5.5.31 merge 2013-05-07 13:05:09 +02:00
Michael Widenius
5333dafa84 Fixed errors and compiler warnings found by buildbot
Solaris fixes:
- Fixed that wait_timeout_func and wait_timeout tests works on solaris
- We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO).
- Fixed that compile-solaris-amd64-debug works (before that we got a wrong ELF class: ELFCLASS64 on linkage)
- Added missing sync_with_master
Other bug fixes:
- Free memory for rpl_global_gtid_binlog_state before exit() to avoid 'accessing uninitalized mutex' error.



BUILD/FINISH.sh:
  Fixed issues on Solaris with ksh
BUILD/compile-solaris-amd64-debug:
  Added missing -m64 flag
configure.cmake:
  We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO)
mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test:
  - Added missing sync_with_master (fix by knielsen)
sql-common/client.c:
  Added () to get rid of compiler warning
sql/item_strfunc.cc:
  Fixed compiler warning
sql/log.cc:
  Free memory for static variable rpl_global_gtid_binlog_state before exit()
  - If we are compiling with safemalloc, we would try to call sf_free() for some members after sf_terminate() was called, which would result of trying to access the uninitalized mutex 'sf_mutex'
sql/multi_range_read.cc:
  Fixed compiler warnings of converting double to ulong.
sql/opt_range.cc:
  Fixed compiler warnings of converting double to ulong or uint
  - Better to have all variables that can be number of rows as 'ha_rows'
sql/rpl_gtid.cc:
  Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
sql/rpl_gtid.h:
  Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
sql/set_var.cc:
  Fixed compiler warning
sql/sql_join_cache.cc:
  Fixed compiler warnings of converting double to uint
sql/sql_show.cc:
  Added cast to get rid of compiler warning
sql/sql_statistics.cc:
  Remove code that didn't do anything.
  (store_record() with record[0] is a no-op)
storage/xtradb/os/os0file.c:
  Added  __attribute__ ((unused))
support-files/compiler_warnings.supp:
  Ignore warnings from atomic_add_64_nv
  (was not able to fix this with a cast as the macro is a bit different between systems)
vio/viosocket.c:
  Added more DBUG_PRINT
2013-05-05 21:39:31 +03:00
Neeraj Bisht
697029d12d BUG#16222245 - CRASH WITH EXPLAIN FOR A QUERY WITH LOOSE SCAN FOR
GROUP BY, MYISAM 

Merge fix for Bug#16222245 from mysql-5.1 to mysql-5.5
2013-04-30 22:46:37 +05:30
Neeraj Bisht
0c9c76e9eb BUG#16222245 - CRASH WITH EXPLAIN FOR A QUERY WITH LOOSE SCAN FOR
GROUP BY, MYISAM 

Problem:-
In a query, where we are using loose index scan optimization and 
we have MIN() causes segmentation fault(where table row length 
is less then key_length).

Analysis:

While using loose index scan for MIN(), we call key_copy(), to copy 
the key data from record.
This function is using temporary record buffer to store key data 
from the record buffer.But in case where the key length is greater 
then the buffer length, this will cause a segmentation fault.


Solution:
Give a proper buffer to store a key record.


sql/opt_range.cc:
  We can't use record buffer to store key data.So, give a proper buffer to store a key record.
2013-04-30 22:38:34 +05:30
Igor Babaev
cd0e834d12 Merge 10.0-base -> 10.0 2013-04-22 20:55:22 -07:00
unknown
9441e53653 MDEV-4345
Sampling of selectivity of LIKE predicate.
2013-04-18 22:22:04 +03:00
Igor Babaev
a1cd28e2e5 Merge 10.0-base -> 10.0 2013-04-17 10:18:04 -07:00
Igor Babaev
b12b3cae85 Added comments.
Renamed the virtual method middle_point_pos for the class Field to
pos_in_interval.
2013-04-15 22:43:07 -07:00
Igor Babaev
f4cd2b37b1 Merge 10.0-base -> mwl253 2013-04-15 09:16:54 -07:00
Sergei Golubchik
a9035be5b7 10.0-base merge 2013-04-15 15:09:22 +02:00
Sergei Golubchik
f57ecb7786 5.5 merge 2013-04-14 10:04:07 +02:00
Jorgen Loland
2c780b461d Bug#16540042: WRONG QUERY RESULT WHEN USING RANGE OVER
PARTIAL INDEX

Consider the following table definition:

CREATE TABLE t (
  my_col CHAR(10),
  ...
  INDEX my_idx (my_col(1))
)

The my_idx index is not able to distinguish between rows with
equal first-character my_col-values (e.g. "f", "foo", "fee").

Prior to this CS, the range optimizer would translate

"WHERE my_col NOT IN ('f', 'h')" into (optimizer trace syntax)

"ranges": [
  "NULL < my_col < f",
  "f < my_col"
]

But this was not correct because the rows with values "foo" 
and "fee" would not belong to any of those ranges. However, the
predicate "my_col != 'f' AND my_col != 'h'" would translate
to 

"ranges": [
  "NULL < my_col"
]

because get_mm_leaf() changes from "<" to "<=" for partial
keyparts. This CS changes the range optimizer implementation 
for NOT IN to behave like a conjunction of NOT EQUAL: it 
replaces "<" with "<=" for all but the first range when the
keypart is partial.
2013-04-12 09:39:56 +02:00
Sergei Golubchik
ce926c90ac 5.3 merge 2013-04-12 01:01:18 +02:00
Sergei Golubchik
ea4a417a8d 5.2 merge 2013-04-11 19:35:39 +02:00
Sergei Golubchik
61ed0ebe73 5.1 merge 2013-04-11 19:30:59 +02:00
Igor Babaev
e3bf08d4b1 Fixed bug mdev-4363.
When calculating the selectivity of a range in the function
get_column_range_cardinality a check whether NULL values are
included into into the range must be done.
2013-04-06 17:18:51 -07:00
Igor Babaev
1c30fb2a15 Fixed bug mdev-4372.
Range analysis of non-indexed columns should handle properly range trees
with type == SEL_TREE::MAYBE.
2013-04-06 12:33:38 -07:00
Sergei Golubchik
7b55b59b57 MDEV-4244 [PATCH] Buffer overruns and use-after-free errors
fixes for gcc 4.8 - compilation warnings and -fsanitize=address
2013-04-06 21:29:12 +02:00
unknown
385de8743a If a range tree has a branch that is an expensive constant,
currently get_mm_tree skipped the evaluation of this constant
and icorrectly proceeded. The correct behavior is to return a
NULL subtree, according to the IF branch being fixed - when it
evaluates the constant it returns a value, and doesn't continue
further.
2013-04-08 12:04:28 +03:00
Igor Babaev
4079a5dc3f Fixed bug mdev-4366.
When performing the range analysis for a conjunction the function
calculate_cond_selectivity_for_table should take in to account that
the analysis of some conjuncts may return SEL_ARG::IMPOSSIBLE.
2013-04-04 14:11:31 -07:00
Igor Babaev
50d4d1ca18 Fixed bug mdev-4367.
When calculating selectivity of conditions one should take into account
the cases when some tables to be joined are empty.
2013-04-03 23:50:14 -07:00