Commit graph

1128 commits

Author SHA1 Message Date
Sergei Golubchik
d9c01e4b4a 5.5 merge 2015-01-21 12:03:02 +01:00
Michael Widenius
5257d71e0e MDEV-6855 Assertion `cond_type == Item::FUNC_ITEM' failed in check_group_min_max_predicates with GROUP BY, aggregate in WHERE SQ, multi-part key
mysql-test/r/group_by.result:
  Test for MDEV-6855
mysql-test/t/group_by.test:
  Test for MDEV-6855
sql/item.h:
  Fixed spelling error
sql/opt_range.cc:
  Added handling of cond_type == Item::CACHE_ITEM in WHERE clauses for MIN/MAX optimization.
  Fixed indentation
2014-12-15 17:13:47 +02:00
Sergey Petrunya
00475d40d1 MDEV-7118: Anemometer stop working after upgrade to from...
When the optimizer considers an option to use Loose Scan, it should 
still consider UNIQUE keys (Previously, MDEV-4120 disabled loose scan
for all kinds of unique indexes. That was wrong)

However, we should not use Loose Scan when trying to satisfy 
 "SELECT DISTINCT col1, col2, .. colN"
when using an index defined as UNIQU(col1, col2, ... colN).
2014-11-19 17:14:49 +03:00
Alexander Barkov
b52d4d0076 MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases 2014-11-18 23:15:54 +04:00
Alexander Barkov
e52b1637e0 MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns
MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns
Disallow using indexes on non-temporal columns to optimize
ref access, range access and table elimination when the counterpart's
cmp_type is TIME_RESULT, e.g.:
  SELECT * FROM t1 WHERE indexed_int_column=time_expression;
Only index on a temporal column can be used to optimize temporal comparison
operations.
2014-11-18 16:33:29 +04:00
Igor Babaev
592b7fbac9 Fixed bug mdev-6325.
Field::selectivity should be set for all fields used in range conditions.
2014-10-28 14:33:31 -07:00
Sergey Petrunya
1b960d9fd6 MDEV-6519: Assertion `join->best_read < double(...)' failed after adding a key to a TokuDB table...
- calculate_cond_selectivity_for_table() should handle the case
  where index statistics is not available (zeros are returned 
  in rec_per_key)
2014-10-10 23:52:47 +04:00
Sergey Petrunya
41b45a8163 MDEV-6738: use_stat_table + histograms crashing optimizer
- When EITS code calls store_key_image_to_rec(), it should follow its 
  calling convention (which is counter-intuitive)
2014-10-10 17:08:12 +04:00
Michael Widenius
70823e1d91 MDEV-5120 Test suite test maria-no-logging fails
The reason for the failure was a bug in an include file on debian that causes 'struct stat'
to have different sized depending on the environment.

This patch fixes so that we always include my_global.h or my_config.h before we include any other files.

Other things:
- Removed #include <my_global.h> in some include files; Better to always do this at the top level to have as few
  "always-include-this-file-first' files as possible.
- Removed usage of some include files that where already included by my_global.h or by other files.


client/mysql_plugin.c:
  Use my_global.h first
client/mysqlslap.c:
  Remove duplicated include files
extra/comp_err.c:
  Remove duplicated include files
include/m_string.h:
  Remove duplicated include files
include/maria.h:
  Remove duplicated include files
libmysqld/emb_qcache.cc:
  Use my_global.h first
plugin/semisync/semisync.h:
  Use my_pthread.h first
sql/datadict.cc:
  Use my_global.h first
sql/debug_sync.cc:
  Use my_global.h first
sql/derror.cc:
  Use my_global.h first
sql/des_key_file.cc:
  Use my_global.h first
sql/discover.cc:
  Use my_global.h first
sql/event_data_objects.cc:
  Use my_global.h first
sql/event_db_repository.cc:
  Use my_global.h first
sql/event_parse_data.cc:
  Use my_global.h first
sql/event_queue.cc:
  Use my_global.h first
sql/event_scheduler.cc:
  Use my_global.h first
sql/events.cc:
  Use my_global.h first
sql/field.cc:
  Use my_global.h first
  Remove duplicated include files
sql/field_conv.cc:
  Use my_global.h first
sql/filesort.cc:
  Use my_global.h first
  Remove duplicated include files
sql/gstream.cc:
  Use my_global.h first
sql/ha_ndbcluster.cc:
  Use my_global.h first
sql/ha_ndbcluster_binlog.cc:
  Use my_global.h first
sql/ha_ndbcluster_cond.cc:
  Use my_global.h first
sql/ha_partition.cc:
  Use my_global.h first
sql/handler.cc:
  Use my_global.h first
sql/hash_filo.cc:
  Use my_global.h first
sql/hostname.cc:
  Use my_global.h first
sql/init.cc:
  Use my_global.h first
sql/item.cc:
  Use my_global.h first
sql/item_buff.cc:
  Use my_global.h first
sql/item_cmpfunc.cc:
  Use my_global.h first
sql/item_create.cc:
  Use my_global.h first
sql/item_geofunc.cc:
  Use my_global.h first
sql/item_inetfunc.cc:
  Use my_global.h first
sql/item_row.cc:
  Use my_global.h first
sql/item_strfunc.cc:
  Use my_global.h first
sql/item_subselect.cc:
  Use my_global.h first
sql/item_sum.cc:
  Use my_global.h first
sql/item_timefunc.cc:
  Use my_global.h first
sql/item_xmlfunc.cc:
  Use my_global.h first
sql/key.cc:
  Use my_global.h first
sql/lock.cc:
  Use my_global.h first
sql/log.cc:
  Use my_global.h first
sql/log_event.cc:
  Use my_global.h first
sql/log_event_old.cc:
  Use my_global.h first
sql/mf_iocache.cc:
  Use my_global.h first
sql/mysql_install_db.cc:
  Remove duplicated include files
sql/mysqld.cc:
  Remove duplicated include files
sql/net_serv.cc:
  Remove duplicated include files
sql/opt_range.cc:
  Use my_global.h first
sql/opt_subselect.cc:
  Use my_global.h first
sql/opt_sum.cc:
  Use my_global.h first
sql/parse_file.cc:
  Use my_global.h first
sql/partition_info.cc:
  Use my_global.h first
sql/procedure.cc:
  Use my_global.h first
sql/protocol.cc:
  Use my_global.h first
sql/records.cc:
  Use my_global.h first
sql/records.h:
  Don't include my_global.h
  Better to do this at the upper level
sql/repl_failsafe.cc:
  Use my_global.h first
sql/rpl_filter.cc:
  Use my_global.h first
sql/rpl_gtid.cc:
  Use my_global.h first
sql/rpl_handler.cc:
  Use my_global.h first
sql/rpl_injector.cc:
  Use my_global.h first
sql/rpl_record.cc:
  Use my_global.h first
sql/rpl_record_old.cc:
  Use my_global.h first
sql/rpl_reporting.cc:
  Use my_global.h first
sql/rpl_rli.cc:
  Use my_global.h first
sql/rpl_tblmap.cc:
  Use my_global.h first
sql/rpl_utility.cc:
  Use my_global.h first
sql/set_var.cc:
  Added comment
sql/slave.cc:
  Use my_global.h first
sql/sp.cc:
  Use my_global.h first
sql/sp_cache.cc:
  Use my_global.h first
sql/sp_head.cc:
  Use my_global.h first
sql/sp_pcontext.cc:
  Use my_global.h first
sql/sp_rcontext.cc:
  Use my_global.h first
sql/spatial.cc:
  Use my_global.h first
sql/sql_acl.cc:
  Use my_global.h first
sql/sql_admin.cc:
  Use my_global.h first
sql/sql_analyse.cc:
  Use my_global.h first
sql/sql_audit.cc:
  Use my_global.h first
sql/sql_base.cc:
  Use my_global.h first
sql/sql_binlog.cc:
  Use my_global.h first
sql/sql_bootstrap.cc:
  Use my_global.h first
  Use my_global.h first
sql/sql_cache.cc:
  Use my_global.h first
sql/sql_class.cc:
  Use my_global.h first
sql/sql_client.cc:
  Use my_global.h first
sql/sql_connect.cc:
  Use my_global.h first
sql/sql_crypt.cc:
  Use my_global.h first
sql/sql_cursor.cc:
  Use my_global.h first
sql/sql_db.cc:
  Use my_global.h first
sql/sql_delete.cc:
  Use my_global.h first
sql/sql_derived.cc:
  Use my_global.h first
sql/sql_do.cc:
  Use my_global.h first
sql/sql_error.cc:
  Use my_global.h first
sql/sql_explain.cc:
  Use my_global.h first
sql/sql_expression_cache.cc:
  Use my_global.h first
sql/sql_handler.cc:
  Use my_global.h first
sql/sql_help.cc:
  Use my_global.h first
sql/sql_insert.cc:
  Use my_global.h first
sql/sql_lex.cc:
  Use my_global.h first
sql/sql_load.cc:
  Use my_global.h first
sql/sql_locale.cc:
  Use my_global.h first
sql/sql_manager.cc:
  Use my_global.h first
sql/sql_parse.cc:
  Use my_global.h first
sql/sql_partition.cc:
  Use my_global.h first
sql/sql_plugin.cc:
  Added comment
sql/sql_prepare.cc:
  Use my_global.h first
sql/sql_priv.h:
  Added error if we use this before including my_global.h
  This check is here becasue so many files includes sql_priv.h first.
sql/sql_profile.cc:
  Use my_global.h first
sql/sql_reload.cc:
  Use my_global.h first
sql/sql_rename.cc:
  Use my_global.h first
sql/sql_repl.cc:
  Use my_global.h first
sql/sql_select.cc:
  Use my_global.h first
sql/sql_servers.cc:
  Use my_global.h first
sql/sql_show.cc:
  Added comment
sql/sql_signal.cc:
  Use my_global.h first
sql/sql_statistics.cc:
  Use my_global.h first
sql/sql_table.cc:
  Use my_global.h first
sql/sql_tablespace.cc:
  Use my_global.h first
sql/sql_test.cc:
  Use my_global.h first
sql/sql_time.cc:
  Use my_global.h first
sql/sql_trigger.cc:
  Use my_global.h first
sql/sql_udf.cc:
  Use my_global.h first
sql/sql_union.cc:
  Use my_global.h first
sql/sql_update.cc:
  Use my_global.h first
sql/sql_view.cc:
  Use my_global.h first
sql/sys_vars.cc:
  Added comment
sql/table.cc:
  Use my_global.h first
sql/thr_malloc.cc:
  Use my_global.h first
sql/transaction.cc:
  Use my_global.h first
sql/uniques.cc:
  Use my_global.h first
sql/unireg.cc:
  Use my_global.h first
sql/unireg.h:
  Removed inclusion of my_global.h
storage/archive/ha_archive.cc:
  Added comment
storage/blackhole/ha_blackhole.cc:
  Use my_global.h first
storage/csv/ha_tina.cc:
  Use my_global.h first
storage/csv/transparent_file.cc:
  Use my_global.h first
storage/federated/ha_federated.cc:
  Use my_global.h first
storage/federatedx/federatedx_io.cc:
  Use my_global.h first
storage/federatedx/federatedx_io_mysql.cc:
  Use my_global.h first
storage/federatedx/federatedx_io_null.cc:
  Use my_global.h first
storage/federatedx/federatedx_txn.cc:
  Use my_global.h first
storage/heap/ha_heap.cc:
  Use my_global.h first
storage/innobase/handler/handler0alter.cc:
  Use my_global.h first
storage/maria/ha_maria.cc:
  Use my_global.h first
storage/maria/unittest/ma_maria_log_cleanup.c:
  Remove duplicated include files
storage/maria/unittest/test_file.c:
  Added comment
storage/myisam/ha_myisam.cc:
  Move sql_plugin.h first as this includes my_global.h
storage/myisammrg/ha_myisammrg.cc:
  Use my_global.h first
storage/oqgraph/oqgraph_thunk.cc:
  Use my_config.h and my_global.h first
  One could not include my_global.h before oqgraph_thunk.h (don't know why)
storage/spider/ha_spider.cc:
  Use my_global.h first
storage/spider/hs_client/config.cpp:
  Use my_global.h first
storage/spider/hs_client/escape.cpp:
  Use my_global.h first
storage/spider/hs_client/fatal.cpp:
  Use my_global.h first
storage/spider/hs_client/hstcpcli.cpp:
  Use my_global.h first
storage/spider/hs_client/socket.cpp:
  Use my_global.h first
storage/spider/hs_client/string_util.cpp:
  Use my_global.h first
storage/spider/spd_conn.cc:
  Use my_global.h first
storage/spider/spd_copy_tables.cc:
  Use my_global.h first
storage/spider/spd_db_conn.cc:
  Use my_global.h first
storage/spider/spd_db_handlersocket.cc:
  Use my_global.h first
storage/spider/spd_db_mysql.cc:
  Use my_global.h first
storage/spider/spd_db_oracle.cc:
  Use my_global.h first
storage/spider/spd_direct_sql.cc:
  Use my_global.h first
storage/spider/spd_i_s.cc:
  Use my_global.h first
storage/spider/spd_malloc.cc:
  Use my_global.h first
storage/spider/spd_param.cc:
  Use my_global.h first
storage/spider/spd_ping_table.cc:
  Use my_global.h first
storage/spider/spd_sys_table.cc:
  Use my_global.h first
storage/spider/spd_table.cc:
  Use my_global.h first
storage/spider/spd_trx.cc:
  Use my_global.h first
storage/xtradb/handler/handler0alter.cc:
  Use my_global.h first
storage/xtradb/handler/i_s.cc:
  Use my_global.h first
2014-09-30 20:31:14 +03:00
Sergei Golubchik
1c6ad62a26 mysql-5.5.39 merge
~40% bugfixed(*) applied
~40$ bugfixed reverted (incorrect or we're not buggy)
~20% bugfixed applied, despite us being not buggy
(*) only changes in the server code, e.g. not cmakefiles
2014-08-02 21:26:16 +02:00
Sergei Golubchik
6fb17a0601 5.5.39 merge 2014-08-07 18:06:56 +02:00
Sergey Petrunya
c714073bfd MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB
- Part #2. Fix obvious problems in the previous patch.
2014-07-22 19:32:58 +04:00
Sergey Petrunya
07c0b1d8d0 MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB
- Filesort has an optmization where it reads only columns that are 
  needed before the sorting is done.
- When ref(_or_null) is picked by the join optimizer, it may remove parts
  of WHERE clause that are guaranteed to be true.
- However, if we use quick select, we must put all of the range columns into the 
  read set. Not doing so will may cause us to fail to detect the end of the range.
2014-07-22 15:52:49 +04:00
Sergei Golubchik
e27c338634 5.5.38 merge 2014-06-06 00:07:27 +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
mithun
f220233512 Bug#17217128 : BAD INTERACTION BETWEEN MIN/MAX AND
"HAVING SUM(DISTINCT)": WRONG RESULTS.
ISSUE:
------
If a query uses loose index scan and it has both
AGG(DISTINCT) and MIN()/MAX()functions. Then, result values
of MIN/MAX() is set improperly.
When query has AGG(DISTINCT) then end_select is set to
end_send_group. "end_send_group" keeps doing aggregation
until it sees a record from next group. And, then it will
send out the result row of that group.
Since query also has MIN()/MAX() and loose index scan is
used, values of MIN/MAX() are set as part of loose index
scan itself. Setting MIN()/MAX() values as part of loose
index scan overwrites values computed in end_send_group.
This caused invalid result.
For such queries to work loose index scan should stop
performing MIN/MAX() aggregation. And, let end_send_group to
do the same. But according to current design loose index
scan can produce only one row per group key. If we have both
MIN() and MAX() then it has to give two records out. This is
not possible as interface has to use common buffer
record[0]! for both records at a time.

SOLUTIONS:
----------
For such queries to work we need a new interface for loose
index scan. Hence, do not choose loose_index_scan for such
cases. So a new rule SA7 is introduced to take care of the
same.

SA7: "If Q has both AGG_FUNC(DISTINCT ...) and
      MIN/MAX() functions then loose index scan access
      method is not used."

mysql-test/r/group_min_max.result:
  Expected result.
mysql-test/t/group_min_max.test:
  1. Test with various combination of AGG(DISTINCT) and
  MIN(), MAX() functions.
  2. Corrected the plan for old queries.
sql/opt_range.cc:
  A new rule SA7 is introduced.
2014-05-15 11:46:57 +05:30
Chaithra Gopalareddy
e1da25f621 Fixing compilation error. Post push fix for Bug#17909656 2014-05-07 16:55:03 +05:30
Chaithra Gopalareddy
8ade414b28 Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY
Problem:
If there is a predicate on a column referenced by MIN/MAX and
that predicate is not present in all the disjunctions on
keyparts earlier in the compound index, Loose Index Scan will
not return correct result.

Analysis:
When loose index scan is chosen, range optimizer currently
groups all the predicates that contain group parts separately
and minmax parts separately. It therefore applies all the
conditions on the group parts first to the fetched row.
Then in the call to next_max, it processes the conditions
which have min/max keypart.

For ex in the following query:
Select f1, max(f2) from t1 where (f1 = 10 and f2 = 13) or
(f1 = 3) group by f1;
Condition (f2 = 13) would be applied even for rows that
satisfy (f1 = 3) thereby giving wrong results.

Solution:
Do not choose loose_index_scan for such cases. So a new rule
WA2 is introduced to take care of the same.

WA2: "If there are predicates on C, these predicates must
be in conjuction to all predicates on all earlier keyparts
in I."

Todo the same, fix reuses the function get_constant_key_infix().
Since this funciton will fail for all multi-range conditions, it
is re-written to recognize that if the sub-conditions are
equivalent across the disjuncts: it will now succeed.
And to achieve this a new helper function is introduced called
all_same().

The fix also moves the test of NGA3 up to the former only
caller, get_constant_key_infix().


mysql-test/r/group_min_max_innodb.result:
  Added test result change for Bug#17909656
mysql-test/t/group_min_max_innodb.test:
  Added test cases for Bug#17909656
sql/opt_range.cc:
  Introduced Rule WA2 because of Bug#17909656
2014-05-07 14:59:23 +05:30
Igor Babaev
d130cef416 Fixed the problem of mdev-6198: statistics.test fails in valgrind.
The problem appeared when a loose scan used a key prefix whose
last component called uint3korr in the implementation of the key_cmp
virtual function.
2014-05-02 15:47:50 -07:00
Sergey Petrunya
182f7d76ee Revert these two changes (wrong push) :
MDEV-5980: EITS: if condition is used for REF access, its selectivity is still in filtered%
MDEV-5985: EITS: selectivity estimates look illogical for join and non-key equalities
MDEV-6003: EITS: ref access, keypart2=const vs keypart2=expr - inconsistent filtered% value
- Made a number of fixes in table_cond_selectivity() so that it returns
  correct selectivity estimates.
- Added comments in related code.
Better comments
2014-04-28 21:49:39 +04:00
Sergey Petrunya
deb26989e9 MDEV-5980: EITS: if condition is used for REF access, its selectivity is still in filtered%
MDEV-5985: EITS: selectivity estimates look illogical for join and non-key equalities
MDEV-6003: EITS: ref access, keypart2=const vs keypart2=expr - inconsistent filtered% value
- Made a number of fixes in table_cond_selectivity() so that it returns
  correct selectivity estimates.
- Added comments in related code.
2014-04-21 15:37:55 +04:00
Igor Babaev
bcf16fa612 Merge. 2014-04-22 14:43:13 -07:00
Igor Babaev
3e0f63c18f Fixed the problem of mdev-5947.
Back-ported from the mysql 5.6 code line the patch with
the following comment:

  Fix for Bug#11757108 CHANGE IN EXECUTION PLAN FOR COUNT_DISTINCT_GROUP_ON_KEY
                       CAUSES PEFORMANCE REGRESSION

  The cause for the performance regression is that the access strategy for the
  GROUP BY query is changed form using "index scan" in mysql-5.1 to use "loose
  index scan" in mysql-5.5. The index used for group by is unique and thus each
  "loose scan" group will only contain one record. Since loose scan needs to
  re-position on each "loose scan" group this query will do a re-position for
  each index entry. Compared to just reading the next index entry as a normal
  index scan does, the use of loose scan for this query becomes more expensive.

  The cause for selecting to use loose scan for this query is that in the current
  code when the size of the "loose scan" group is one, the formula for
  calculating the cost estimates becomes almost identical to the cost of using
  normal index scan. Differences in use of integer versus floating point arithmetic
  can cause one or the other access strategy to be selected.

  The main issue with the formula for estimating the cost of using loose scan is
  that it does not take into account that it is more costly to do a re-position
  for each "loose scan" group compared to just reading the next index entry.
  Both index scan and loose scan estimates the cpu cost as:

    "number of entries needed too read/scan" * ROW_EVALUATE_COST

  The results from testing with the query in this bug indicates that the real
  cost for doing re-position four to eight times higher than just reading the
  next index entry. Thus, the cpu cost estimate for loose scan should be increased.
  To account for the extra work to re-position in the index we increase the
  cost for loose index scan to include the cost of navigating the index.
  This is modelled as a function of the height of the b-tree:

    navigation cost= ceil(log(records in table)/log(indexes per block))
                   * ROWID_COMPARE_COST;

  This will avoid loose index scan being used for indexes where the "loose scan"
  group contains very few index entries.
2014-04-22 14:39:57 -07:00
Sergey Petrunya
7216afbc78 MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503 ...
- Backport the fix for MySQL Bug#13947868
- Add our testcase (they don't publish theirs)
2014-04-18 14:07:54 +04:00
Sergey Petrunya
26a3d567c9 MDEV-5992: EITS: Selectivity of non-indexed condition is counted twice in table's fanout
MDEV-5984: EITS: Incorrect filtered% value for single-table select with range access
- Fix calculate_cond_selectivity_for_table() to work correctly with range accesses 
  over multi-component keys:
  = First, take selectivity of all possible range scans into account. Remember which 
    fields were used bt the range scans.
  = Then, calculate selectivity produced by sargable predicates on fields. If a 
    field was used in a possible range access, assume its selectivity is already
    taken into account.
- Fix table_cond_selectivity(): when quick select is used, selectivity of
  COND(table) is taken into account in matching_candidates_in_table(). In
  table_cond_selectivity() we should not apply it for the second time.
2014-04-01 09:59:51 -07:00
Igor Babaev
887a210ffc Fixed bug mdev-5931.
After constant table row substitution the where condition may be converted
to always true. The function calculate_cond_selectivity_for_table() should
take into account this possibility.
2014-03-22 12:44:39 -07:00
Sergey Petrunya
365ba070fe MDEV-5814: MySQL Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
- Adopt MySQL's fix: don't run index_merge optimizer if the table statistics 
  reports that the table has 0 rows.
2014-03-14 18:52:16 +01:00
Sergei Golubchik
4c788b06d4 10.0-base merge 2014-03-05 23:20:10 +01:00
Sergei Golubchik
99316b51b6 compilation failure with BUILD/compile-amd64-valgrind-max 2014-03-26 08:24:19 +01:00
Sergei Golubchik
21a17536c6 5.3 merge 2014-03-25 11:09:12 +01:00
unknown
2eb920b262 Fix to make it compiling with valgrind. 2014-03-21 12:23:09 +02:00
Sergei Golubchik
5d0c01608c 5.2 merge 2014-03-16 21:03:01 +01:00
Sergei Golubchik
e772cbd7b7 5.1 merge 2014-03-16 13:59:44 +01:00
Sergei Golubchik
d7304375e5 mysql-5.1.73 merge 2014-03-15 18:24:15 +01:00
Igor Babaev
1a536c8daf Fixed bug mdev-5635.
After constant row substitution some field items become constant items.
The range analyzer should take into account this fact when looking for
ranges.
2014-02-27 13:54:05 -08:00
Sergei Golubchik
0dc23679c8 10.0-base merge 2014-02-26 15:28:07 +01:00
Sergey Petrunya
c397f97407 MDEV-5732: Valgrind warning for index_merge and extended_keys
- Make is_key_scan_ror() take into account the existence of extended keys.
2014-02-25 19:25:49 +04:00
Sergey Petrunya
6ebaa4939e Backport the following from 5.5 to 5.3:
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.
2014-02-19 18:34:12 +04:00
Sergey Vojtovich
d12c7adf71 MDEV-5314 - Compiling fails on OSX using clang
This is port of fix for MySQL BUG#17647863.

revno: 5572
revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
timestamp: Thu 2013-10-31 00:22:43 +0100
message:
  Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM

  Rename test() macro to MY_TEST() to avoid conflict with libc++.
2014-02-19 14:05:15 +04:00
Sergey Petrunya
2f22e85d05 Backport from 10.0 to 10.0-base the following:
revision-id: psergey@askmonty.org-20140204092710-2yt5ysa5ej3l2c03
MDEV-5606: range optimizer: "x < y" is sargable, while "y > x" is not
Port to mariadb-1.0 the following fix from mysql-5.6:
      
Revision ID: jorgen.loland@oracle.com-20120314131055-ml54x9deueqfsff4
BUG#13701206: WHERE A>=B DOES NOT GIVE SAME EXECUTION PLAN
              AS WHERE B<=A (RANGE OPTIMIZER)
       
that fix didn't have a public testcase, so I created one.
2014-02-12 21:37:58 +04:00
Igor Babaev
80a38b92d4 Fixed bug mdev-5630.
The function calculate_cond_selectivity_for_table() must consider
the case when the key range tree returned by the call of get_mm_tree()
is of the type SEL_TREE::ALWAYS.
2014-02-11 19:22:17 -08:00
Michael Widenius
10001c8e4f Automatic merge 2014-02-05 19:23:11 +02:00
Sergei Golubchik
5475cc7765 merge 2014-02-04 10:49:44 +01:00
Sergey Petrunya
75a3527777 MDEV-5606: range optimizer: "x < y" is sargable, while "y > x" is not
Port to mariadb-1.0 the following fix from mysql-5.6:

  Revision ID: jorgen.loland@oracle.com-20120314131055-ml54x9deueqfsff4
  BUG#13701206: WHERE A>=B DOES NOT GIVE SAME EXECUTION PLAN
                AS WHERE B<=A (RANGE OPTIMIZER)
 
that fix didn't have a public testcase, so I created one.
2014-02-04 13:27:10 +04:00
Sergei Golubchik
72c20282db 10.0-base merge 2014-02-03 15:22:39 +01:00
Sergei Golubchik
59d9d08e2b 5.5 merge 2014-02-01 00:54:03 +01:00
Sergei Golubchik
37d240ecf9 MySQL-5.5.35 merge 2014-01-22 15:29:36 +01:00
Michael Widenius
273078c5fa Fixes to get valgrind to work with jemalloc
- Added MALLOC_LIBRARY variable to hold name of malloc library
- Back ported valgrind related fixes from jemalloc 3.4.1 to the included jemalloc 3.3.1
- Renamed bitmap_init() and bitmap_free() to my_bitmap_init() and my_bitmap_free() to avoid clash with jemalloc 3.4.1
- Use option --soname-synonyms=somalloc=NON to valgrind when using jemalloc
- Show version related variables in mysqld --help
  -- Added SHOW_VALUE_IN_HELP marker

Increased back_log to 150 as the original value was a bit too small


CMakeLists.txt:
  Added MALLOC_LIBRARY variable to hold name of malloc library
cmake/jemalloc.cmake:
  Added MALLOC_LIBRARY variable to hold name of malloc library
config.h.cmake:
  Added MALLOC_LIBRARY variable to hold name of malloc library
extra/jemalloc/ChangeLog:
  Updates changelog
extra/jemalloc/include/jemalloc/internal/arena.h:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/include/jemalloc/internal/private_namespace.h:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/include/jemalloc/internal/tcache.h:
  Backported valgrind fixes from jemalloc 3.4.1
extra/jemalloc/src/arena.c:
  Backported valgrind fixes from jemalloc 3.4.1
include/my_bitmap.h:
  Renamed bitmap_init() and bitmap_free() to my_bitmap_init() and my_bitmap_free() to avoid clash with jemalloc 3.4.1
mysql-test/mysql-test-run.pl:
  Use option --soname-synonyms=somalloc=NON to valgrind when using jemalloc
mysql-test/valgrind.supp:
  Supression of memory leak in OpenSuse 12.3
mysys/my_bitmap.c:
  Renamed bitmap_init() and bitmap_free() to my_bitmap_init() and my_bitmap_free()
sql/ha_ndbcluster_binlog.cc:
  Renames
sql/ha_ndbcluster_cond.h:
  Renames
sql/ha_partition.cc:
  Renames
sql/handler.cc:
  Renames
sql/item_subselect.cc:
  Renames
sql/log_event.cc:
  Renames
sql/log_event_old.cc:
  Renames
sql/mysqld.cc:
  Renames
  Show version related variables in mysqld --help
sql/opt_range.cc:
  Renames
sql/opt_table_elimination.cc:
  Renames
sql/partition_info.cc:
  Renames
sql/rpl_injector.h:
  Renames
sql/set_var.h:
  Renames
sql/slave.cc:
  Renames
sql/sql_bitmap.h:
  Renames
sql/sql_insert.cc:
  Renames
sql/sql_lex.h:
  Renames
sql/sql_parse.cc:
  Renames
sql/sql_partition.cc:
  Renames
sql/sql_select.cc:
  Renames
sql/sql_show.cc:
  Renames
sql/sql_update.cc:
  Renames
sql/sys_vars.cc:
  Show version related variables in mysqld --help
sql/sys_vars.h:
  Added SHOW_VALUE_IN_HELP marker for variables that should be shown in --help
sql/table.cc:
  Renames
sql/table.h:
  Removed not used bitmap_init_value
storage/connect/ha_connect.cc:
  Removed compiler warning
storage/maria/ma_open.c:
  Renames
unittest/mysys/bitmap-t.c:
  Renames
2014-01-02 11:19:19 +02:00
Sergei Golubchik
d28d3ba40d 10.0-base merge 2013-12-16 13:02:21 +01:00
Igor Babaev
8efaff4959 Fixed bug mdev-5415.
Do not calculate selectivity of conditions for the tables of the information schema.
2013-12-14 19:13:37 -08:00