Commit graph

34034 commits

Author SHA1 Message Date
Elena Stepanova
872a01b6b1 MDEV-6178 mysql_upgrade breaks databases with long user names
Added a test, the problem itself was fixed in MDEV-6068
2014-04-28 02:38:03 +04:00
Alexander Barkov
fbfa004327 MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations 2014-04-25 17:10:25 +04:00
Alexander Barkov
d3d3a4b834 MDEV-4511 Assertion `scale <= precision' fails on GROUP BY TIMEDIFF with incorrect types 2014-04-24 16:59:01 +04:00
unknown
aefddfe3ff Fix sporadic test failures in rpl_mariadb_slave_capability.test.
The problem is the async binlog checkpointing; this could on rare
occasions occur too late, causing SHOW BINLOG EVENTS to show the
wrong events and cause .result file difference.
2014-04-24 09:41:31 +02:00
Alexander Barkov
4c56dfe95b MDEV-5851 MySQL WL#5303 Romansh locale for DAYNAME, MONTHNAME, DATE_FORMAT 2014-04-24 10:30:13 +04:00
unknown
010971a761 MDEV-6156: Parallel replication incorrectly caches charset between worker threads
Replication caches the character sets used in a query, to be able to quickly
reuse them for the next query in the common case of them not having changed.

In parallel replication, this caching needs to be per-worker-thread. The
code was not modified to handle this correctly, so the caching in one worker
could cause another worker to run a query using the wrong character set,
causing replication corruption.
2014-04-23 16:06:06 +02:00
Alexander Barkov
f9e5f237f0 MDEV-6027 RLIKE: "." no longer matching new line
Added a new system variable:
default_regex_flags='DOTALL,DUPNAMES,EXTENDED,EXTRA,MULTILINE,UNGREEDY'
2014-04-23 10:57:25 +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
Alexander Barkov
ed93e55bac MDEV-5975 Prepared statements with DATE literals do not honor NO_ZERO_IN_DATE 2014-04-22 11:23:35 +04:00
Alexander Barkov
213f10363e MDEV-6045 MySQL Bug#11829861 - SUBSTRING_INDEX() RESULTS "OMIT" CHARACTER WHEN USED INSIDE LOWER() 2014-04-21 13:19:32 +04:00
Alexander Barkov
5fc5195fc5 An after-fix for
MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found

Recording the forgotten test results.
2014-04-21 11:29:50 +04:00
Alexander Barkov
cfa4548ba5 MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found 2014-04-21 10:13:38 +04: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
Alexander Barkov
8db600f951 MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value 2014-04-18 12:19:51 +04:00
Igor Babaev
12eb6d88f7 Fixed the problem of mdev-5970:
back-ported the patch for bug #13256831 from mysql-5.6 code line.

  Here's the comment this patch was provided with:

  Fixed bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD.

  This bug only occurs if a user tries to update a base table using
  an updatable view and this view was created as a join for which
  the clause 'WITH CHECK OPTION' was specified.

  The reason for the bug was that when such an update was
  executed, row positions were not properly handled for tables
  that were not updated but had constraints that had to be
  checked due to the 'WITH CHECK OPTION' clause.

  The reason for the bug was that when such update is executed
  then for tables specified in the view definition and
  also listed in the 'WITH CHECK OPTION' clause the positioning to
  row being updated is not performed.
2014-04-17 12:53:53 -07:00
Igor Babaev
13dc299a4f Fixed bugs mdev-5927 and mdev-6116.
Both bugs are caused by the same problem: the function optimize_cond() should
update the value of *cond_equal rather than the value of join->cond_equal,
because it is called not only for the WHERE condition, but for the HAVING
condition as well.
2014-04-16 22:34:52 -07:00
Sergey Vojtovich
bd44c086b3 MDEV-6059 - Result files with no corresponding test files
Removed unused result files.
2014-04-16 09:49:30 +04:00
Sujatha Sivakumar
1b74f2e3da Bug#17942050:KILL OF TRUNCATE TABLE WILL LEAD TO BINARY LOG
WRITTEN WHILE ROWS REMAINS

Problem:
========
When truncate table fails while using transactional based
engines even though the operation errors out we still
continue and log it to binlog. Because of this master has
data but the truncate will be written to binary log which
will cause inconsistency.

Analysis:
========
Truncate table can happen either through drop and create of
table or by deleting rows. In the second case the existing
code is written in such a way that even if an error occurs
the truncate statement will always be binlogged. Which is not
correct.

Binlogging of TRUNCATE TABLE statement should check whether
truncate is executed "transactionally or not". If the table
is transaction based we log the TRUNCATE TABLE only on
successful completion.

If table is non transactional there are possibilities that on
error we could have partial changes done hence in such cases
we do log in spite of errors as some of the lines might have
been removed, so the statement has to be sent to slave.

Fix:
===
Using table handler whether truncate table is being executed
in transaction based mode or not is identified and statement
is binlogged accordingly.

mysql-test/suite/binlog/r/binlog_truncate_kill.result:
  Added test case to test the fix for Bug#17942050.
mysql-test/suite/binlog/t/binlog_truncate_kill.test:
  Added test case to test the fix for Bug#17942050.
sql/sql_truncate.cc:
  Check if truncation is successful or not and retun appropriate
  return values so that binlogging can be done based on that.
sql/sql_truncate.h:
  Added a new enum.
2014-04-15 15:17:25 +05:30
Sergey Petrunya
244d4b532a MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
Add a testcase and backport this fix:

Bug#14338686: MYSQL IS GENERATING DIFFERENT AND SLOWER
              (IN NEWER VERSIONS) EXECUTION PLAN
PROBLEM:
While checking for an index to sort for the order by clause
in this query
"SELECT datestamp FROM contractStatusHistory WHERE
contract_id = contracts.id ORDER BY datestamp asc limit 1;"

we do not calculate the number of rows to be examined correctly.
As a result we choose index 'idx_contractStatusHistory_datestamp'
defined on the 'datestamp' field, rather than choosing index
'contract_id'. And hence the lower performance.

ANALYSIS:
While checking if an index is present to give the records in
sorted order(datestamp), we consider the selectivity of the
'ref_key'(contract_id here) using 'table->quick_condition_rows'.
'ref_key' here can be an index from 'REF_ACCESS' or from 'RANGE'.

As this is a 'REF_ACCESS', 'table->quick_condition_rows' is not
set to the actual value which is 2. Instead is set to the number
of tuples present in the table indicating that every row that
is selected would be satisfying the condition present in the query.

Hence, the selectivity becomes 1 even when we choose the index
on the order by column instead of the join_condition.

But, in reality as only 2 rows satisy the condition, we need to
examine half of the entire data set to get one tuple when we
choose index on the order by column.
Had we chosen the 'REF_ACCESS' we would have examined only 2 tuples.
Hence the delay in executing the query specified.
  
FIX:
While calculating the selectivity of the ref_key:
For REF_ACCESS consider quick_rows[ref_key] if range 
optimizer has an estimate for this key. Else consider 
'rec_per_key' statistic.
For RANGE ACCESS consider 'table->quick_condition_rows'.
2014-04-12 01:01:32 +04:00
unknown
65f80d4052 Merge MDEV-6067 from 5.2 to 5.3. 2014-04-11 09:38:55 +02:00
unknown
a1ae8f9ba8 MDEV-6067: Partitioned table DML sometimes binlogged without XID event
Add test case.
2014-04-11 09:03:53 +02:00
Sergey Petrunya
2bbca99018 MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
- Make JOIN::const_key_parts include keyparts for which 
  the WHERE clause has an equality in form 
  "t.key_part=reference_outside_this_select"
- This allows to avoid filesort'ing in some cases (and also 
  avoid a difficult choice between using filesort or using an index)
2014-04-07 13:49:48 +04:00
unknown
39afdcddd1 MDEV-5401: Wrong result (missing row) on a 2nd execution of PS with exists_to_in=on, MERGE view or a SELECT SQ
The problem was that the view substitute its fields (on prepare) with reverting the change after execution. After prepare on optimization exists2in convertion substituted arguments of '=' with constsnt '1', but then one of the arguments of '=' was reverted to the view field reference.This lead to incorrect WHERE condition on the second execution.

To fix the problem we replace whole '=' with '1' permannently.
2014-04-10 12:14:18 +03:00
unknown
2480b60bb7 MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication
The code did not correctly handle the update of position for Rotate events in the
binlog/relaylog when using parallel replication.
2014-04-09 14:42:46 +02:00
Serge Kozlov
7f8fb4509e BUG#18506556. Added sync slave with master for clean-up 2014-04-04 10:42:25 +04:00
Sergey Petrunya
b1a1a79a69 Merge 2014-04-02 03:56:04 -07: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
Elena Stepanova
2f60292aa4 Options option_name=0 in combination files were processed incorrectly 2014-03-31 18:04:05 +04:00
Sergei Golubchik
9d04a25604 temporarily disable part of the test in ps-protocol. name resolution issues.
see MDEV-5981
2014-03-29 14:16:58 +01:00
Sergei Golubchik
73f4861575 MDEV-5969 Crash in prepared statement with NO_ZERO_IN_DATE and ROLLUP
MDEV-5971 Asymmetry between CAST(DATE'2001-00-00') to INT and TO CHAR in prepared statements

Consistently set maybe_null flag, even not-NULL temporal literal may become NULL
in the restrictive sql_mode.
2014-03-29 11:33:20 +01:00
Sergei Golubchik
b37157e49e update the result file 2014-03-29 11:32:49 +01:00
Michael Widenius
d5a185a552 automatic merge 2014-03-28 21:42:57 +02:00
Michael Widenius
3f7ee1f12e Updated sponsors and authors 2014-03-28 09:31:43 +02:00
Michael Widenius
10ae6e35d0 Fixed that the we don't change CREATE to CREATE OR REPLACE, except if the slave removed an existing table as part of CREATE.
This will help the following replicaition scenario:
MariaDB 10.0 master (statement replication) -> MariaDB 10.0 slave (row based replication) -> MySQL or MariaDB 5.x slave


mysql-test/r/mysqld--help.result:
  Updated help text
mysql-test/suite/rpl/r/create_or_replace_mix.result:
  Added more tests
mysql-test/suite/rpl/r/create_or_replace_row.result:
  Added more tests
mysql-test/suite/rpl/r/create_or_replace_statement.result:
  Added more tests
mysql-test/suite/rpl/t/create_or_replace.inc:
  Added more tests
sql/handler.h:
  Added org_options so that we can detect what come from the query and what was possible added later.
sql/sql_insert.cc:
  Only write CREATE OR REPLACE if was originally specified or if we delete a conflicting table as part of create
sql/sql_parse.cc:
  Remember orginal create options
sql/sql_table.cc:
  Only write CREATE OR REPLACE if was originally specified or if we delete a conflicting table as part of create
sql/sys_vars.cc:
  Updated help text
2014-03-28 09:31:24 +02:00
Sergey Petrunya
68015a99cd Change the order of parameters in DECODE_HISTOGRAM to match the order of fields in
mysql.column_stats.
2014-03-28 23:18:33 +04:00
Sergey Petrunya
9a06e531f4 Merge 2014-03-28 00:38:56 +04:00
Sergey Petrunya
92e49bb066 MDEV-4360: ANALYZE shows "Table is already up to date" while updating stats
- Show a line with "Engine-independent statistics collected" when ANALYZE command
  caused EITS statistics to be recollected.
2014-03-28 00:32:53 +04:00
Sergei Golubchik
3b33caaca3 mtr: remove --use-copy, autodetect symlink support instead 2014-03-27 12:04:34 +01:00
Sergei Golubchik
43498927fa update .result file 2014-03-27 11:25:27 +01:00
Michael Widenius
4cc3fd48f6 MDEV-5876: MySQL bug #11766767 - "59957: VIEW USING MERGE PERMISSIONS IN MULTI-TABLE UPDATE"
Backported multi_update_check_table_access() from 5.6

The code is slightly different in MariaDB, becasue we instansiate fields in merged tables earlier.

mysql-test/mysql-test-run.pl:
  Fixed comment
mysql-test/r/view_grant.result:
  Merged test case from 5.6
mysql-test/t/view_grant.test:
  Merged test case from 5.6
sql/sql_parse.cc:
  Reset orig_want_privilege as this will be rechecked later.
  If not, we will have a problem in mysql_multi_update_prepare() for the call to mysql_handle_derived()
sql/sql_update.cc:
  Backport multi_update_check_table_access() from 5.6
2014-03-24 08:18:01 +02:00
Michael Widenius
7c81a51516 Make copy_up_file_and_fill() safe for disk full
Fixed use-copy option to mysql-test-run

mysql-test/mysql-test-run.pl:
  Fixed use-copy and added comment
sql/log.cc:
  Make copy_up_file_and_fill() safe for disk full
2014-03-23 21:09:38 +02:00
Michael Widenius
9aac546872 MDEV-5930 Server crashes in thd_get_ha_data on CREATE OR REPLACE TABLE
mysql-test/r/create_or_replace.result:
  More tests for create or replace
mysql-test/t/create_or_replace.test:
  More tests for create or replace
sql/log.cc:
  Don't use binlog_hton if binlog is not enabmed
sql/sql_base.cc:
  We have to call restart_trans_for_tables also if tables where not locked with LOCK TABLES.
  If not, we will get a crash in TokuDB
sql/sql_insert.cc:
  Don't call binlog_reset_cache() if we don't have binary log open
sql/sql_table.cc:
  Don't log to binary log if not open
  Better test if we where using create or replace ... select
storage/tokudb/mysql-test/tokudb_mariadb/r/create_or_replace.result:
  More tests for create or replace
storage/tokudb/mysql-test/tokudb_mariadb/t/create_or_replace.test:
  More tests for create or replace
2014-03-23 18:39:10 +02:00
Michael Widenius
39e6083e35 MDEV-5818: MySQL WL#6145: Separate the dependence of DATA DIRECTORY from symbolic links
Copied relevant test cases and code from the MySQL 5.6 tree
Testing of my_use_symdir moved to engines.


mysql-test/r/partition_windows.result:
  Updated result file
mysql-test/suite/archive/archive_no_symlink-master.opt:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_no_symlink.result:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_no_symlink.test:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_symlink.result:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_symlink.test:
  Testing of symlinks with archive
sql/log_event.cc:
  Updated comment
sql/partition_info.cc:
  Don't test my_use_symdir here
sql/sql_parse.cc:
  Updated comment
sql/sql_table.cc:
  Don't test my_use_symdir here
sql/table.cc:
  Added more DBUG_PRINT
storage/archive/ha_archive.cc:
  Give warnings for index_file_name and if we can't use data directory
storage/myisam/ha_myisam.cc:
  Give warnings if we can't use data directory or index directory
2014-03-23 17:00:29 +02:00
Michael Widenius
b18a1b0e6c MDEV-5850: MySQL Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names
Bug #3329 Incomplete lower_case_table_names=2 implementation

The problem was that check_db_name() converted database names to lower case also in case of lower_case_table_names=2.

Fixed by removing the conversion in check_db_name for lower_case_table_names = 2 and instead converting db name to
lower case at same places as table names are converted.

Fixed bug that SHOW CREATE DATABASE FOO showed information for database 'foo'.

I also removed some checks of lower_case_table_names when it was enough to use table_alias_charset.


mysql-test/mysql-test-run.pl:
  Added --use-copy argument to force mysql-test-run to copy files instead of doing symlinks. This is needed when you run
  with test directory on another file system
mysql-test/r/lowercase_table.result:
  Updated results
mysql-test/r/lowercase_table2.result:
  Updated results
mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result:
  Updated results
mysql-test/suite/parts/r/partition_mgm_lc2_memory.result:
  Updated results
mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result:
  Updated results
mysql-test/t/lowercase_table.test:
  Added tests with mixed case databases
mysql-test/t/lowercase_table2.test:
  Added tests with mixed case databases
sql/log.cc:
  Don't check lower_case_table_names when we can use table_alias_charset
sql/sql_base.cc:
  Don't check lower_case_table_names when we can use table_alias_charset
sql/sql_db.cc:
  Use cmp_db_names() for checking if current database changed.
  mysql_rm_db() now converts db to lower case if lower_case_table_names was used.
  Changed database options cache to use table_alias_charset. This fixed a bug where SHOW CREATE DATABASE showed wrong information.
sql/sql_parse.cc:
  Change also db name to lower case when file names are changed.
  Don't need to story copy of database name anymore when lower_case_table_names == 2 as check_db_name() don't convert in this case.
  Updated arguments to mysqld_show_create_db().
  When adding table to TABLE_LIST also convert db name to lower case if needed (same way as we do with table names).
sql/sql_show.cc:
  mysqld_show_create_db() now also takes original name as argument for output to user.
sql/sql_show.h:
  Updated prototype for mysqld_show_create_db()
sql/sql_table.cc:
  In mysql_rename_table(), do same conversions to database name as we do for the file name
2014-03-23 15:43:57 +02:00
Alexander Barkov
63d0918807 MDEV-5783 Assertion `0' failed in make_sortkey(SORTPARAM*, uchar*, uchar*) on ORDER BY HEX( UNCOMPRESSED_LENGTH( pk ) ) 2014-03-23 16:02:56 +04:00
Sergey Petrunya
79a8a6130b Code cleanup:
- Move [some] engine-agnostic tests from t/selectivity.test to t/selectivity_no_engine.test
- Move Histogram::point_selectivity to sql_statistics.cc
2014-03-27 13:08:00 +04:00
Sergey Petrunya
0d67aafaa2 Merge 2014-03-27 12:37:05 +04:00
Sergey Petrunya
ab061a2bb3 MDEV-5926, MDEV-4362 post-fixes:
- Histogram::find_bucket() should not walk off the end of the value range.
- Address review feedback in Histogram::point_selectivity(): different handling
  for zero-width buckets, and explanations.
2014-03-27 12:30:49 +04:00
Sergei Golubchik
1a4c8ae1be heap.test: hide a warning on 32-bit 2014-03-27 08:11:05 +01:00
Sergei Golubchik
97687f2888 Fix hostcache_ipv4_blocked and hostcache_ipv6_blocked to pass.
Don't abort plugin reads whem mpvio->make_it_fail is set - this can leak information.
2014-03-26 22:32:10 +01:00
Sergei Golubchik
10740939eb 5.5 merge 2014-03-26 22:25:38 +01:00
Sergei Golubchik
44002a34e6 MDEV-5955 Server crashes in handler::ha_external_lock or assertion `m_lock_type == 2' fails in handler::ha_close on disconnect with a locked temporary table
first unlock locked tables, then close and remove temporary
2014-03-26 19:56:23 +01:00
Michael Widenius
ded448d1d0 MDEV-5905: Creating tmp. memory table kills the server
The reason was that a couple of variables that hold number of rows that was used to calculate buffers was uint and caused an overflow.

Fixed by changing variables that could hold number of rows from uint to ulong and also added a cast for this test.

include/heap.h:
  Reorder to get better alignment. Changed variables that could hold number of rows from uint to ulong
mysql-test/suite/heap/heap.result:
  Added test case
mysql-test/suite/heap/heap.test:
  Added test case
mysql-test/suite/plugins/t/server_audit.test:
  Added sleep as we want to have disconnect logged before we try a new connect
storage/heap/ha_heap.cc:
  Changed variables that could hold number of rows from uint to ulong
  Limit number of rows to 4G  (as most of the variables that holds rows are ulong anyway)
  reset records_changed when key_stat_version is changed to not cause increments for every row changed
storage/heap/ha_heap.h:
  changed records_changed to ulong as this can get big
storage/heap/hp_create.c:
  Changed variables that could hold number of rows from uint to ulong
  Added cast (fixed the original bug)
storage/heap/hp_delete.c:
  Changed variables that could hold number of rows from uint to ulong
storage/heap/hp_open.c:
  Removed not needed cast
storage/heap/hp_write.c:
  Changed variables that could hold number of rows from uint to ulong
support-files/compiler_warnings.supp:
  Removed extra : from supression
2014-03-26 21:58:27 +02:00
Sergey Petrunya
dee11f9633 MDEV-4362: {division by zero when lookup constant is outside the value table}
- Fix Histogram::point_selectivity() to work in the case where the 
  passed value_pos=0 (or 1) and the first (or the last) bucket in the 
  histogram has zero value-range (i.e one value).
2014-03-26 21:05:31 +04:00
Sergey Petrunya
ad842b5f05 MDEV-5926: EITS: Histogram estimates for column=least_possible_value are wrong
[Attempt #2]
- Use a new selectivity calculation formula in Histogram::point_selectivity. 
  The formula is different from the old one because it was developed from scratch.
  it doesn't have any possible division-by-zero problems.
2014-03-26 17:55:00 +04:00
Sergei Golubchik
a91c59c2af MDEV-5920 MySQL Bug#16765410 FTS: STACK AROUND THE VARIABLE 'MYSTR' WAS CORRUPTED IN INNOBASE_STRNXFRM 2014-03-26 09:43:02 +01:00
Sergei Golubchik
319bcde937 MDEV-5861 MySQL Bug#12601974 - STORED PROCEDURE SQL_MODE=NO_BACKSLASH_ESCAPES IGNORED AND BREAKS REPLICATION
escape usernames in CREATE/DROP USER error messages according to NO_BACKSLASH_ESCAPES
2014-03-26 09:42:52 +01:00
Sergei Golubchik
88ec8a08f3 MDEV-5909 MySQL BUG#11748924 PARTITIONS: TOO-LONG COMMENT CAUSES NO WARNING 2014-03-26 09:41:28 +01:00
Sergei Golubchik
11b498d6e0 build_frm_image(): don't try to guess the "real table name" from the
field list, it doesn't work if ALTER TABLE has replaced all fields.
Instead, pass the correct original table name down from the caller.
2014-03-26 09:41:16 +01:00
Sergei Golubchik
1b468ca675 MDEV-5815 MySQL BUG#11751736: DROP DATABASE STATEMENT SHOULD REMOVE .OLD SUFFIX FROM DATABASE DIRECTORY
Delete .OLD and .TMD files when a MyISAM table is dropped.
Same for Aria.

sql/sql_db.cc:
  dead code - *.TMD cannot be deleted from here.
2014-03-26 09:32:54 +01:00
Sergei Golubchik
21a17536c6 5.3 merge 2014-03-25 11:09:12 +01:00
Sergei Golubchik
bd4e7dac59 mysqltest bug: reset --replace command after every
error message (because error messages use replacements)
2014-03-24 20:02:00 +01:00
Sergei Golubchik
097566d61c rpl tests: move "include/master-slave.inc" down to be after all possible
checks that can skip the test
2014-03-24 20:01:45 +01:00
Sergei Golubchik
f17831fa74 MDEV-5817 MySQL BUG#11825482: Broken key length calculation for btree index
just as in 5.6 fix - copy the correct null-handling code from MyISAM
2014-03-21 14:36:49 +01:00
Sergei Golubchik
a52e2c787d MDEV-5823 MySQL bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED TABLE CORRUPTS MYISAM
add the test case only
2014-03-21 14:05:44 +01:00
Sergey Petrunya
e59dec0345 MDEV-5917: EITS: different order of predicates in IN (...) causes different estimates
- Forgot to update one .result file.
2014-03-21 15:42:37 +04:00
Sergei Golubchik
3bb249612f MDEV-5846 MySQL Bug #18144 - Cost with FORCE/USE index seems incorrect in some cases. 2014-03-20 23:27:08 +01:00
Sergei Golubchik
dee0fd4233 MDEV-5820 MySQL Bug #54805 definitions in regex/my_regex.h conflict with /usr/include/regex.h 2014-03-20 23:26:50 +01:00
Sergei Golubchik
7b1b744f53 MDEV-5849 MySQL bug#12602983 - User without privilege on routine can discover its existence by executing "select non_existing_func();" or by "call non_existing_proc()"
add or move privilege checks before existence checks
2014-03-20 23:26:41 +01:00
Sergey Petrunya
0e211841f2 MDEV-5917: EITS: different order of predicates in IN (...) causes different estimates
- Save range key before making field->pos_in_interval() call (like we do for non-equality ranges)
2014-03-21 00:53:41 +04:00
Sergei Golubchik
9ff0c9f730 MDEV-5858 MySQL Bug#12744991 - DECIMAL_ROUND(X,D) GIVES WRONG RESULTS WHEN D == N*(-9)
don't use mysql-5.6 change.
correct fix: zero-out rounded tail after the number was shifted because
of the carry digit (otherwise the carry digit will be zeroed out too).
2014-03-20 09:50:45 +01:00
Sergey Vojtovich
e4fde57712 MDEV-5864 - Reduce usage of LOCK_open: TABLE_SHARE::tdc.free_tables
Let TABLE_SHARE::tdc.free_tables, TABLE_SHARE::tdc.all_tables,
TABLE_SHARE::tdc.flushed and corresponding invariants be protected by
per-share TABLE_SHARE::tdc.LOCK_table_share instead of global LOCK_open.
2014-03-20 11:11:13 +04:00
Sergei Golubchik
47f438675b MDEV-5894 MySQL BUG#34750: Print database name in Unknown Table error message 2014-03-20 00:44:35 +01:00
Michael Widenius
f71dc02e67 Automatic merge 2014-03-20 01:07:01 +02:00
Michael Widenius
c4bb7cd6dc Fix for MDEV-5589: "Discrepancy in binlog on half-failed CREATE OR REPLACE"
Now if CREATE OR REPLACE fails but we have deleted a table already, we will generate a DROP TABLE in the binary log.
This fixes this issue.

In addition, for a failing CREATE OR REPLACE TABLE ... SELECT we don't generate a log of all the inserted rows, only the DROP TABLE.

I added code for not logging DROP TEMPORARY TABLE for tables where the CREATE TABLE was not logged. This code will be activated in 10.1
by removing the code protected by DONT_LOG_DROP_OF_TEMPORARY_TABLES.





mysql-test/suite/rpl/r/create_or_replace_mix.result:
  More test cases
mysql-test/suite/rpl/r/create_or_replace_row.result:
  More test cases
mysql-test/suite/rpl/r/create_or_replace_statement.result:
  More test cases
mysql-test/suite/rpl/t/create_or_replace.inc:
  More test cases
sql/log.cc:
  Added binlog_reset_cache() to clear the binary log.
sql/log.h:
  Added prototype
sql/sql_insert.cc:
  If CREATE OR REPLACE TABLE ... SELECT fails:
  - Don't log anything if nothing changed
  - If table was deleted, log a DROP TABLE.
  Remember if we table creation of temporary tables was logged.
sql/sql_table.cc:
  Added log_drop_table()
  Remember if we table creation of temporary tables was logged.
  If CREATE OR REPLACE TABLE ... SELECT fails and a table was deleted, log a DROP TABLE.
sql/sql_table.h:
  Added prototype
sql/sql_truncate.cc:
  Remember if we table creation of temporary tables was logged.
sql/table.h:
  Added table_creation_was_logged
2014-03-20 00:59:13 +02:00
Igor Babaev
d51ee6d412 Merge. 2014-03-19 14:58:29 -07:00
Sergei Golubchik
9418bd9c21 MDEV-5898 FOUND_ROWS() return incorrect value when using DISTINCT
revert the fix for MDEV-5549, use a different approach.
2014-03-19 20:33:12 +01:00
Michael Widenius
913d1f199c MDEV-5854 Interrupted CREATE OR REPLACE is written into binlog, and in a wrong format
mysql-test/r/create_or_replace2.result:
  Added test case
mysql-test/t/create_or_replace.test:
  Fixed comment
mysql-test/t/create_or_replace2.test:
  Added test case
sql/sql_base.cc:
  Safety fix:
  Don't let threads with query_id=0 free temporary tables as this may free temporary tables not in use.
  This is mostly the case for the slave io threads, as most other threads has thd->query_id != 0.
sql/sql_table.cc:
  Added comment.
  Ignore kill when opening temporary table for CREATE ... LIKE.
  This fixed the original isue
2014-03-19 15:15:57 +02:00
unknown
e7704bfdd6 RBR triggers compiled-out with ifdefs in 10.0 2014-03-19 11:35:32 +02:00
unknown
af3180ab6f MDEV-9095: Executing triggers on slave in row-based replication 2014-03-19 11:00:56 +02:00
Sergei Golubchik
948056c535 MDEV-5787 Server crashes in in row_mysql_convert_row_to_innobase on CREATE .. SELECT
XtraDB: don't accept MYSQL_TYPE_NULL as a column type
2014-03-19 09:57:57 +01:00
Sergei Golubchik
3e3d627114 MDEV-5771 Privileges acquired via roles depend on the order of granting
GRANT ROLE: don't forget to propagate privileges from granted role to a grantee
2014-03-19 09:57:45 +01:00
Alexander Barkov
ce3c457e6d MDEV-5781 Item_sum_std::val_real(): Assertion `nr >= 0.0' fails on query with STDDEV_POP, ROUND and variable 2014-03-23 19:43:01 +04:00
Alexander Barkov
92bd6801b9 A joint patch for:
- MDEV-5689 ExtractValue(xml, 'substring(/x,/y)') crashes
- MDEV-5709 ExtractValue() with XPath variable references returns wrong result.

Description:

1. The main problem was that that nodeset_func->fix_fields() was
called in Item_func_xml_extractvalue::val_str() and
Item_func_xml_update::val_str(), which led in some cases to
execution of the XPath engine *before* having a parsed XML value.
Moved to Item_xml_str_func::fix_fields().

2. Cleanup: added a new method Item_xml_str_func::fix_fields() and moved
most of the code from Item_xml_str_func::fix_length_and_dec()
to Item_xml_str_func::fix_fields(), to follow the usual Item layout.

3. Cleanup: a parsed XML value is useless without the raw XML value
it was built from.

Previously the parsed and the raw values where stored in separate String
instances. It was hard to follow how they are synchronized.
Added a helper class XML which contains both parsed and raw values.
Makes things easier to read and modify.

4. MDEV-5709: const_item() could incorrectly return a "true"
result when XPath expression contains users/SP variable references.
Now nodeset_func->const_item() is also taken into account to
catch such cases.

5. Minor code enhancements.
2014-03-23 15:15:07 +04:00
Alexander Barkov
e0f75b1bff MDEV-5870 Assertion `ltime->neg == 0' fails with COALESCE, ADDDATE, MAKEDATE
A huge number in the "day" part of an interval made the code to return
a negative date erroneously. Adding a test to return an error on a too
large "day" value.
2014-03-23 14:22:44 +04: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
unknown
b352969118 MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts
Due to how gap locks work, two transactions could group commit together on the
master, but get lock conflicts and then deadlock due to different thread
scheduling order on slave.

For now, remove these deadlocks by running the parallel slave in READ
COMMITTED mode. And let InnoDB/XtraDB allow statement-based binlogging for the
parallel slave in READ COMMITTED.

We are also investigating a different solution long-term, which is based on
relaxing the gap locks only between the transactions running in parallel for
one slave, but not against possibly external transactions.
2014-03-21 13:30:55 +01:00
unknown
a5418c5540 MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction
When a transaction fails in parallel replication, it should signal the error
to any following transactions doing wait_for_prior_commit() on it. But the
code for this was incorrect, and would not correctly remember a prior error
when sending the signal. This caused corruption when slave stopped due to an
error.

Fix by remembering the error code when we first get an error, and passing the
saved error code to wakeup_subsequent_commits().

Thanks to nanyi607rao who reported this bug on
maria-developers@lists.launchpad.net and analysed the root cause.
2014-03-21 10:11:28 +01:00
Praveenkumar Hulakund
95e99e1263 Bug#11759519 - INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA
LOCAL AND IMPORT ERRORS

Description:
-----------
This bug happens due to the fact that current algorithm is designed
that in the case of LOCAL load of data, in case of the error, the
remaining part of the file is read in order to return the proper
error message to the client side.

But, the problem with current implementation is that data stream
for the client side is cleared only in the case where line delimiters
exist, which is not a case with, for example fixed width
fields.

Fix:
----
Ported patch provided by Sinisa Milivojevic n bug report for this
issue to 5.5+ versions.

As part of this patch code is changed to clear the data stream
by calling new member function "READ_INFO::skip_data_till_eof".
2014-03-19 12:30:30 +05:30
Igor Babaev
06ef0bdad2 Fixed bug mdev-5191.
Corrected cost estimates when a join buffer is used and the optimizer is requested
to use condition selectivities.
2014-03-18 11:30:50 -07:00
Sergei Golubchik
0f6505456b merge 2014-03-18 18:29:07 +01:00
Michael Widenius
7b57dcb463 Fixed buildbot issues
mysql-test/suite/rpl/t/rpl_000011-slave.opt:
  Renamed test case as it's slave that needs to restarted
support-files/compiler_warnings.supp:
  Fixed bad characters in suppression
2014-03-18 16:26:02 +02:00
Michael Widenius
1127d56735 Fixed some buildbot failures
mysql-test/suite/rpl/t/rpl_000011-master.opt:
  Added master.opt file to ensure that other tests don't interfere with rpl_000011
plugin/server_audit/server_audit.c:
  Fixed compiler error on solaris
support-files/compiler_warnings.supp:
  Ignore warning from xtradb
2014-03-18 10:26:50 +02:00
Sergey Petrunya
8dae5a8a89 Merge 2014-03-18 12:06:32 +04:00
Sergey Petrunya
727896df27 Merge 2014-03-17 13:45:56 +04:00
unknown
4e1a928d18 Fix missing .result file update before push. 2014-03-17 09:44:17 +01:00
Sergei Golubchik
5d0c01608c 5.2 merge 2014-03-16 21:03:01 +01:00
Sergei Golubchik
5d8c15228e 5.3-merge 2014-03-16 19:21:37 +01:00
Sergey Petrunya
07a52afd00 MDEV-4410: update does not want to use a covering index, but select uses it
- If an UPDATE 1) modifies the key it is using, and 2) has ORDER BY ... LIMIT
  which matches the key it is using,  Then we should use "Using buffer", not
  "Using filesort".
2014-03-16 14:33:37 +01:00
Sergei Golubchik
e772cbd7b7 5.1 merge 2014-03-16 13:59:44 +01:00
Sergei Golubchik
cfc83cf9d3 5.2 merge 2014-03-16 12:44:47 +01:00
Sergei Golubchik
d7304375e5 mysql-5.1.73 merge 2014-03-15 18:24:15 +01: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
Sergey Petrunya
43a43b8289 Merge 2014-03-14 17:23:13 +01:00
Michael Widenius
dd13db6f4a MDEV-5829: STOP SLAVE resets global status variables
Reason for the bug was an optimization for higher connect speed where we moved when global status was updated,
but forgot to update states when slave thread dies.
Fixed by adding thd->add_status_to_global() before deleting slave thread's thd.


mysys/my_delete.c:
  Added missing newline
sql/mysqld.cc:
  Use add_status_to_global()
sql/slave.cc:
  Added missing add_status_to_global()
sql/sql_class.cc:
  Use add_status_to_global()
sql/sql_class.h:
  Simplify adding local status to global by adding add_status_to_global()
2014-03-14 16:29:23 +02:00
unknown
5c8ed7dd54 MDEV-5446: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' fails on EXPLAIN EXTENDED with VALUES function
field_index should be set correctly for null field created by Item_insert_value::fix_fields().
2014-03-14 11:38:17 +02:00
unknown
f9b3cc11bc MDEV-5819: MySQL Bug #13500371 63704: CONVERSION OF '1.' TO A NUMBER GIVES ERROR 1265 (WARN_DATA_TRUNCATED)
Fix by MySQL ported
2014-03-14 09:31:16 +02:00
Sergei Golubchik
8428c116c7 don't run unix_socket tests when $USER is already present in mysql.user
(as it's done in 10.0)
2014-03-13 20:12:50 +01:00
Sergei Golubchik
a0ea960c3e 5.2 merge 2014-03-13 18:36:52 +01:00
Sergei Golubchik
5616bd5597 unix_socket bypasses make_if_fail by not doing any network reads 2014-03-13 16:35:14 +01:00
Sergei Golubchik
18830d78a3 mtr: move if(unix_socket) test to include/have_unix_socket.inc 2014-03-13 16:34:34 +01:00
Michael Widenius
e63c03db8d Merge with 10.0-base
Automatic merge, except for server_audit.cc that had to be modified slightly
Changes to xtradb and innobase where ignored was these made no sence for 10.0
2014-03-13 16:43:11 +02:00
Sergey Petrunya
8c04dd33dd MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
- With big_tables=ON, materialized table will use Aria (or MyISAM) SE, which
  allows prefix key reads. However, the temp.table has rec_per_key=NULL which
  causes the optimizer to crash when attempting to read index statistics for a 
  prefix index read.
- Fixed by providing a rec_per_key array with zeros (i.e. "no statistics data")
2014-03-13 12:20:57 +01:00
unknown
70c08df4dc MDEV-5840: group_concat( column_json(dynamic_column )) return empty result
Fixed max_length of dynamic columns json/create/add functions.
2014-03-13 10:38:41 +02:00
Sergei Golubchik
8940611079 update test results 2014-03-12 12:34:47 +01:00
Sergei Golubchik
4e29d31c58 typo fixed 2014-03-12 12:34:36 +01:00
unknown
d8ea8a3d13 MDEV-5717: Server crash with insert statement containing DEFAULT into view
Item_default_value::arg can be NULL so walk() should take it into consideration.
2014-03-12 12:34:16 +02:00
Michael Widenius
f320b12ca5 MDEV-5619: CREATE OR REPLACE does not release MDL_EXCLUSIVE upon failure
mysql-test/r/create_or_replace.result:
  Added test of releasing of metadata locks
mysql-test/t/create_or_replace.test:
  Added test of releasing of metadata locks
sql/handler.h:
  Added marker if table was deleted as part of CREATE OR REPLACE
sql/sql_base.cc:
  Added Locked_tables_list::unlock_locked_table()
sql/sql_class.h:
  New prototypes
sql/sql_insert.cc:
  Unlock metadata locks for deleted table in case of error. Also do unlock tables if this was the only locked table.
sql/sql_table.cc:
  Unlock metadata locks for deleted table in case of error. Also do unlock tables if this was the only locked table.
2014-03-12 11:26:40 +02:00
Michael Widenius
49ca12a107 Fixed some failing tests
Remove memory warnings if mysql client aborts early
Changed copyright for clients

client/mysql.cc:
  Free memory if get_options fails, so that we don't get warnings from safemalloc
include/welcome_copyright_notice.h:
  Added SkySQL to client copyrights
mysql-test/valgrind.supp:
  Added suppressions for memory leaks from dlopen() for OpenSUSE 12.3
storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.result:
  Suppress warning
storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.test:
  Suppress warning
2014-03-12 11:24:03 +02:00
unknown
8b9b7ec395 MDEV-5804: If same GTID is received on multiple master connections in multi-source replication, the event is double-executed causing corruption or replication failure
Some fixes, mainly to make it work in non-parallel replication mode also
(--slave-parallel-threads=0).

Patch should be fairly complete now.
2014-03-12 00:14:49 +01:00
Michael Widenius
1727849659 Merge with 5.5 2014-03-11 17:49:09 +02:00
Michael Widenius
599eb0dc86 Fixed MDEV-5724 "Server crashes on SQL select containing more group by and left join statements using innodb tables"
The problem was that a big record was allocated on the stack, which casued stack to run out.
  
Fixed by using my_safe_alloca() instead of my_alloca() when allocating records.
Now only records <= 16384 are allocated on the stack.

mysql-test/r/stack-crash.result:
  Added test case
mysql-test/t/stack-crash.test:
  Added test case
storage/maria/ma_blockrec.c:
  Use my_safe_alloca() instead of my_alloca()
storage/maria/ma_dynrec.c:
  Use my_safe_alloca() instead of my_alloca()
storage/maria/maria_def.h:
  Added MARIA_MAX_RECORD_ON_STACK
storage/maria/maria_pack.c:
  Use my_safe_alloca() instead of my_alloca()
2014-03-10 21:40:27 +02:00
unknown
2c2478b822 MDEV-5804: If same GTID is received on multiple master connections in multi-source replication, the event is double-executed causing corruption or replication failure
Before, the arrival of same GTID twice in multi-source replication
would cause double-apply or in gtid strict mode an error.

Keep the behaviour, but add an option --gtid-ignore-duplicates which
allows to correctly handle duplicates, ignoring all but the first.
This relies on the user ensuring correct configuration so that
sequence numbers are strictly increasing within each replication
domain; then duplicates can be detected simply by comparing the
sequence numbers against what is already applied.

Only one master connection (but possibly multiple parallel worker
threads within that connection) is allowed to apply events within
one replication domain at a time; any other connection that
receives a GTID in the same domain either discards it (if it is
already applied) or waits for the other connection to not have
any events to apply.

Intermediate patch, as proof-of-concept for testing. The main limitation
is that currently it is only implemented for parallel replication,
@@slave_parallel_threads > 0.
2014-03-09 10:27:38 +01:00
Elena Stepanova
5c31e79f8b create_or_replace test failed with embedded-server due to different
thread IDs
2014-03-15 16:56:35 +04:00
Sergey Petrunya
908fa69da9 Bug #13571700 TINYBLOB NOT NULL, CRASH IN PROTOCOL::NET_STORE_DATA
- Backport testcase from mysql-5.6
2014-03-07 13:21:16 +01:00
Sergey Petrunya
5ba109c4f6 Bug#45227: Lost HAVING clause led to a wrong result.
- Backport testcase from mysql-5.6
2014-03-07 13:14:58 +01:00
Sergey Petrunya
f20cab1a83 BUG#13803810: TOO FEW ROWS RETURNED FOR RANGE ACCESS IN VARCHAR INDEX USING DATETIME VALUE
- Backport the testcase from mysql-5.6
2014-03-07 13:00:20 +01:00
unknown
321ff25f3d MDEV-5740: Assertion `!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test' failed on 2nd execution of PS with derived_merge
Do not check tables of executed units.
Debug info about stages of derived tables execution added.
2014-03-07 13:57:07 +02:00
Sergey Petrunya
7af71b74a9 BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
- Backport testcase from mysql-5.6
2014-03-07 12:49:40 +01:00
Elena Stepanova
f62eec5223 The test had synchronization point, but did not save master position
before that, which caused indeterministic outcome
2014-03-11 00:02:22 +04:00
Michael Widenius
3b55c2fe21 Fixed MDEV-5724 "Server crashes on SQL select containing more group by and left join statements using innodb tables"
The problem was that a big record was allocated on the stack, which casued stack to run out.

Fixed by using my_safe_alloca() instead of my_alloca() when allocating records.
Now only records <= 16384 are allocated on the stack.

mysql-test/r/stack-crash.result:
  Added test case
mysql-test/t/stack-crash.test:
  Added test case
storage/maria/ma_blockrec.c:
  Use my_safe_alloca() instead of my_alloca()
storage/maria/ma_dynrec.c:
  Use my_safe_alloca() instead of my_alloca()
storage/maria/maria_def.h:
  Added MARIA_MAX_RECORD_ON_STACK
storage/maria/maria_pack.c:
  Use my_safe_alloca() instead of my_alloca()
2014-03-10 21:14:38 +02:00
Michael Widenius
b07f9f72dc Fixed MDEV-5780 "create-big fails in 10.0"
The issue was that create...trigger part of the test suite used a debug_sync point that before was never triggered (in other words, wrong meaningless test).
With the new create ... replace code the debug sync point is triggered and the test case could not handled that.

I fixed this by adding a wait and go for the debug syncpoint in the test.

Removed some compiler warnings from mysql_cond_timedwait


include/mysql/psi/mysql_thread.h:
  Removed compiler warnings
mysql-test/r/create-big.result:
  New test result
mysql-test/t/create-big.test:
  Fixed test case as create_table_select_before_check_if_exists was not before triggered by the code.
2014-03-10 14:08:12 +02:00
Sergei Golubchik
12f54d7de0 @@old_mode=zero_date_time_cast 2014-03-07 21:05:28 +01:00
Sergei Golubchik
a5fdd75980 XtraDB made the default 2014-03-07 15:21:07 +01:00
unknown
2aa619ec68 MDEV-5788: Incorrect free of rgi->deferred_events in parallel replication
When an rpl_group_info object was returned from the free list, the
rgi->deferred_events_collecting and rgi->deferred_events was not correctly
re-inited. Additionally, the rgi->deferred_events was incorrectly freed in
free_rgi(), which causes unnecessary malloc/free (or crash when re-init is not
done).

Thanks to user nanyi607rao, who reported this bug on maria-developers@.
2014-03-07 12:02:09 +01:00
Igor Babaev
1f2ef57403 Fixed bug mdev-5686.
The calls of the function remove_eq_conds() may change the and/or structure
of the where conditions. So JOIN::equal_cond should be updated for non-recursive
calls of remove_eq_conds().
2014-03-06 13:56:34 -08:00
Alexander Barkov
89e1715355 MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with MySQL-5.6 (and the SQL Standard) 2014-03-07 00:21:25 +04:00
Sergey Vojtovich
b95c8ce530 MDEV-5675 - Performance: my_hash_sort_bin is called too often
Reduced number of my_hash_sort_bin() calls from 4 to 1 per query.
Reduced number of memory accesses done by my_hash_sort_bin().

Details:
- let MDL subsystem use pre-calculated hash value for hash
  inserts and deletes
- let table cache use pre-calculated MDL hash value
- MDL namespace is excluded from hash value calculation, so that
  hash value can be used by table cache as is
- hash value for MDL is calculated as resulting hash value + MDL
  namespace
- extended hash implementation to accept user defined hash function
2014-03-06 16:19:12 +04:00
Sergei Golubchik
4c788b06d4 10.0-base merge 2014-03-05 23:20:10 +01:00
Sergey Petrunya
5bb978777e Merge 2014-03-05 01:57:57 +04:00
Michael Widenius
2520e8d1da Fixed timing problem in rpl_heartbeat_basic.test
mysql-test/suite/rpl/t/rpl_heartbeat_basic.test:
  Added sync_slave_with_master to remove timing problem
2014-03-04 20:32:52 +02:00
unknown
5ec49e6452 Merge MDEV-5754, MDEV-5769, and MDEV-5764 into 10.0 2014-03-04 14:32:42 +01:00
unknown
bd2a0a2389 Merge MDEV-5754, MDEV-5769, and MDEV-5764 into 10.0-base 2014-03-04 14:21:00 +01:00
unknown
b5b8210849 MDEV-5754: MySQL 5.5 slaves cannot replicate from MariaDB 10.0
The problem was when a GTID event was part of a group commit, and so contained
a commit id. The code that replaces GTID with a BEGIN event for old slaves did
not correctly handle this case.

Fix the code so that the GTID with commit id can also be properly replaced
with a BEGIN query event. The extra two bytes are in the BEGIN event replaced
with a dummy, empty time zone string.
2014-03-04 13:10:14 +01:00
Sergey Petrunya
64649e3393 MDEV-5723: mysqldump -uroot unusable for multi-database operations, checks all databases
- Make do_fill_table() use join_tab->cache_select->cond if it is present.  When 
  join_tab->cache_select->cond is present, join_tab->select_cond doesn't have any 
  conditions that are usable for I_S optimizations.
2014-03-04 15:14:40 +04:00
Namit Sharma
b263e9d5bb BUG#11754425 - Upmerge from 5.1 -> 5.5 2014-03-04 13:51:56 +05:30
Namit Sharma
a9db74f46d BUG#11754425 - rpl_innodb_bug28430 times out on
certain pb2 hosts. Removed rpl_innodb_bug28430 from 
default.experimental as BUG can't be repeated
2014-03-04 13:48:13 +05:30
unknown
ec374f1e53 MDEV-5769: Slave crashes on attempt to do parallel replication from an older master
Older master has no GTID events, so such events are not available for
deciding on scheduling of event groups and so on.

With this patch, we run such events from old masters single-threaded, in the
sql driver thread.

This seems better than trying to make the parallel code handle the data from
older masters; while possible, this would require a lot of testing (as well as
possibly some extra overhead in the scheduling of events), which hardly seems
worthwhile.
2014-03-04 08:48:32 +01:00
Sergei Golubchik
eb9f422c43 MDEV-5667 online alter and changed field/index options
use the Alter_inplace_info::ALTER_COLUMN_OPTION flag if
field/column flags were altered.

change ha_example to use check_if_supported_inplace_alter() instead
of obsolete check_if_incompatible_data()
2014-03-02 15:02:13 +01:00
Sergei Golubchik
04de6ccc31 MDEV-5668 Assertion `granted_role->is_role()' fails on granting role with empty name
parser: error out on empty role names
2014-03-01 11:55:31 +01:00
Michael Widenius
a10a9448b0 Added new states to be able to better diagnose where server hangs.
- Table locks now ends with state "After table lock"
- Open table now ends with state "After opening tables"
- All calls to close_thread_tables(), not only from mysql_execute_command(), has state "closing tables"
- Added state "executing" for mysql admin commands, like CACHE INDEX, REPAIR TABLE etc.
- Added state "Finding key cache" for CACHE INDEX
- Added state "Filling schema table" when we generate temporary table for SHOW commands and information schema.

Other things:
Add limit from innobase for thread_sleep_delay. This fixed a failing tests case.
Added db.opt to support-files to make 'make package' work


mysql-test/suite/funcs_1/datadict/processlist_val.inc:
  Use new state
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result:
  Updated test result because of new state
mysql-test/suite/funcs_1/r/processlist_val_no_prot.result:
  Updated test result because of new state
sql/CMakeLists.txt:
  Have option files in support-files
sql/lock.cc:
  Added new state 'After table lock'
sql/sql_admin.cc:
  Added state "executing" and "Sending data" for mysql admin commands, like CACHE INDEX, REPAIR TABLE etc.
  Added state "Finding key cache"
sql/sql_base.cc:
  open tables now ends with state "After table lock", instead of NULL
sql/sql_parse.cc:
  Moved state "closing tables" to close_thread_tables()
sql/sql_show.cc:
  Added state "Filling schema table" when we generate temporary table for SHOW commands and information schema.
storage/xtradb/buf/buf0buf.c:
  Removed compiler warning
storage/xtradb/handler/ha_innodb.cc:
  Add limit from innobase for thread_sleep_delay. This fixed a failing tests case.
support-files/db.opt:
  cmakes needs this to create data/test directory
2014-05-03 19:12:17 +03:00
Alexander Barkov
f467f4bb93 MDEV-5459 Illegal mix of collations for datetime 2014-04-28 17:01:58 +04:00
Alexander Barkov
1081e403c6 MDEV-5702 Incorrect results are returned with NULLIF() 2014-04-28 15:56:31 +04:00
unknown
968f4d4e25 MDEV-6139: UPDATE w/ join against MRG_MyISAM table with read-only sub-table failsUPDATE w/ join against MRG_MyISAM table with read-only sub-table fails
The problem was that on opening all tables TL_WRITE, than local tables which is not updated set to TL_READ, but underlying tables of MyISAMmrg left untouched.

Prartition engine has not this problem.

All cases where lock_type assigned is not changed because call of virtual function is not cheap.
2014-04-28 09:13:53 +03:00
Elena Stepanova
53612e7787 Modified the condition for skipping innodb.innodb-autoinc to exclude
the part which was defined by MariaDB version and thus caused a wrong
check result
2014-04-28 03:37:53 +04:00
Elena Stepanova
64d7c97db9 MDEV-6178 mysql_upgrade breaks databases with long user names
Added a 5.5-specific test which involves manual modification of system
tables. The problem itself was fixed in MDEV-6068
2014-04-28 02:56:53 +04:00
Elena Stepanova
4ccea172ff MDEV-6169 main.myisam-metadata fails mtr internal check
The test didn't clean debug_sync
2014-04-26 23:16:51 +04:00
Elena Stepanova
ca47b5652b MDEV-6168 rpl.rpl_heartbeat_basic fails mtr internal check
Synchronization with master was missing
2014-04-26 21:32:08 +04:00
Michael Widenius
b17a053cc9 MDEV-6129: Server crashes during UNION with ORDER BY field IS NULL
Fixed crashing bug for union queries where there was no real tables.


mysql-test/r/group_by.result:
  Added test case
mysql-test/t/group_by.test:
  Added test case
sql/db.opt:
  Removed genrated file
sql/item.cc:
  Handled case when table_list->pos_in_tables is not set. Can only happens when there is no real tables in query
2014-04-24 18:20:57 +03:00
Alexander Barkov
64d33032a6 Merge 5.3->5.5 2014-04-23 17:43:20 +04:00
Alexander Barkov
2f93e7cf47 MDEV-6146 Can't mix (latin1_swedish_ci,NUMERIC) and (utf8_unicode_ci,IMPLICIT) for MATCH 2014-04-23 10:28:06 +04:00
Alexander Barkov
31c82360e4 Merge from 5.3 2014-04-21 14:22:18 +04:00
Alexander Barkov
f5b73fe3f1 Merge from 5.3. 2014-04-21 12:19:47 +04:00
Alexander Barkov
1c6d508a2b Merge from 5.3 2014-04-18 13:41:15 +04:00
Alexander Barkov
f7a47e137b Merge from 5.3 2014-04-18 12:16:56 +04:00
Alexey Botchkov
142c20eda9 MDEV-4856 SQL_ERROR_LOG shows 1146 errors which didnt appear in mysql client.
The fill_schema_table() function used to call get_table_share() for a table name in WHERE
    then clear the error list. That way plugins receive the superfluous error notification if it
    happens in it. Also the problem was that error handler didn't prevent the suppressed
    error message from logging anyway as the logging happens in THD::raise_condition
    before the handler call.
    Trigger_error_handler is remade into Warnings_only_error_handler, so it stores the error
    message in all cases in the thd->stmt_da.
    Then later the stored error is raised.
2014-04-15 20:41:08 +05:00
Alexey Botchkov
365960a068 MDEV-5138 Numerous test failures in "mtr --ps --embedded".
As Davi added code like
          sav_protocol= thd->protocol
          thd->protocol= &thd->protocol_binary
          ...
          thd->protocol= sav_protocol
  the fucntions like emb_store_querycache_result() cannot determine
  the used protocol testing thd->protocol == &thd->protocol_binary.
  Fixed by additional check thd->command == COM_STMT_EXECUTE.
2014-04-15 18:09:58 +05:00
unknown
05722f06b2 MDEV-5991: crash in Item_field::used_tables
Units of subqueroes from excluded expressions should be excluded from select_lex/select_unit tree.
2014-04-15 13:20:26 +03:00
Sergei Golubchik
a53d794fa7 mtr: don't use --mysqld= options when issuing "mysqld --help"
(and don't append --user=root for --help now, when mysqld has a fix for that)
2014-04-13 14:58:55 +02:00
Sergei Golubchik
a0ea7ffade fix the test for 32-bit 2014-04-11 11:42:51 +02:00
Sergei Golubchik
27a26acb1c MDEV-5700 Cannot SHOW CREATE VIEW if underlying tabels are ALTERed 2014-04-10 15:07:34 +02:00
Sergei Golubchik
32b3c9f35d Make THDVAR_INT variables to be signed in SELECT in SHOW 2014-04-09 14:28:07 +02:00
Sergei Golubchik
5f0c98c17b MDEV-5743 Server crashes in mysql_alter_table on an attempt to add a primary key to InnoDB table 2014-04-07 21:53:19 +02:00
unknown
be785cd85c Merge MDEV-6067 from 5.3 to 5.5. 2014-04-11 10:46:11 +02:00
Sergei Golubchik
cb67dcb618 mysql-5.5.37 selective merge 2014-03-27 22:26:58 +01:00
Sergei Golubchik
41c760b121 merge 2014-02-28 10:00:31 +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
8d0238a6d8 MDEV-4955 discover of table non-existance on CREATE
Fix ha_table_exists() to take discovery into account correctly.
It must be able to discover both table existence (when no frm is
found) and table non-existance (when frm was found).
2014-02-27 22:43:42 +01:00
Sergei Golubchik
05aba79e98 MDEV-4447 MariaDB sources should have unix-style line endings everywhere 2014-02-27 12:00:16 +01:00
Sergey Petrunya
472bc477f6 Merge 2014-02-27 13:43:06 +04:00
Sergey Petrunya
d7081b2524 Update test results after fix for MDEV-5732 2014-02-27 13:40:40 +04:00
Sergei Golubchik
15ee97214d InnoDB 5.6.15 merge.
update test results
2014-02-26 19:36:33 +01:00
unknown
6d3150c48d Merge MDEV-5657 (parallel replication) to 10.0-base 2014-02-26 17:03:32 +01:00
unknown
20959fa09c Merge MDEV-5657 (parallel replication) to 10.0 2014-02-26 16:38:42 +01:00
Sergei Golubchik
0dc23679c8 10.0-base merge 2014-02-26 15:28:07 +01:00
unknown
e90f68c0ba MDEV-5657: Parallel replication.
Clean up and improve the parallel implementation code, mainly related to
scheduling of work to threads and handling of stop and errors.

Fix a lot of bugs in various corner cases that could lead to crashes or
corruption.

Fix that a single replication domain could easily grab all worker threads and
stall all other domains; now a configuration variable
--slave-domain-parallel-threads allows to limit the number of
workers.

Allow next event group to start as soon as previous group begins the commit
phase (as opposed to when it ends it); this allows multiple event groups on
the slave to participate in group commit, even when no other opportunities for
parallelism are available.

Various fixes:

 - Fix some races in the rpl.rpl_parallel test case.

 - Fix an old incorrect assertion in Log_event iocache read.

 - Fix repeated malloc/free of wait_for_commit and rpl_group_info objects.

 - Simplify wait_for_commit wakeup logic.

 - Fix one case in queue_for_group_commit() where killing one thread would
   fail to correctly signal the error to the next, causing loss of the
   transaction after slave restart.

 - Fix leaking of pthreads (and their allocated stack) due to missing
   PTHREAD_CREATE_DETACHED attribute.

 - Fix how one batch of group-committed transactions wait for the previous
   batch before starting to execute themselves. The old code had a very
   complex scheduling where the first transaction was handled differently,
   with subtle bugs in corner cases. Now each event group is always scheduled
   for a new worker (in a round-robin fashion amongst available workers).
   Keep a count of how many transactions have started to commit, and wait for
   that counter to reach the appropriate value.

 - Fix slave stop to wait for all workers to actually complete processing;
   before, the wait was for update of last_committed_sub_id, which happens a
   bit earlier, and could leave worker threads potentially accessing bits of
   the replication state that is no longer valid after slave stop.

 - Fix a couple of places where the test suite would kill a thread waiting
   inside enter_cond() in connection with debug_sync; debug_sync + kill can
   crash in rare cases due to a race with mysys_var_current_mutex in this
   case.

 - Fix some corner cases where we had enter_cond() but no exit_cond().

 - Fix that we could get failure in wait_for_prior_commit() but forget to flag
   the error with my_error().

 - Fix slave stop (both for normal stop and stop due to error). Now, at stop
   we pick a specific safe point (in terms of event groups executed) and make
   sure that all event groups before that point are executed to completion,
   and that no event group after start executing; this ensures a safe place to
   restart replication, even for non-transactional stuff/DDL. In error stop,
   make sure that all prior event groups are allowed to execute to completion,
   and that any later event groups that have started are rolled back, if
   possible. The old code could leave eg. T1 and T3 committed but T2 not, or
   it could even leave half a transaction not rolled back in some random
   worker, which would cause big problems when that worker was later reused
   after slave restart.

 - Fix the accounting of amount of events queued for one worker. Before, the
   amount was reduced immediately as soon as the events were dequeued (which
   happens all at once); this allowed twice the amount of events to be queued
   in memory for each single worker, which is not what users would expect.

 - Fix that an error set during execution of one event was sometimes not
   cleared before executing the next, causing problems with the error
   reporting.

 - Fix incorrect handling of thd->killed in worker threads.
2014-02-26 15:02:09 +01:00
Sergey Vojtovich
9d918f41d3 MDEV-5612 - my_rename() deletes files when it shouldn't
Ported fix for MySQL BUG#51861.
2014-02-26 12:55:28 +04:00
Sergei Golubchik
0b9a0a3517 5.5 merge 2014-02-25 16:04:35 +01:00
Sergey Petrunya
6324c36bd7 Update test results after the previous push 2014-02-25 13:01:57 +04:00
sayantan dutta
6f027d9dfc Bug #17926328 - MTR SHOULD NOT WAIT FOR CHILDREN WHEN ABORTING TEST RUN ON WINDOWS 2014-02-25 18:42:14 +05:30
Sergey Petrunya
fb6183a80b MDEV-5244: Make extended_keys=ON by default in 10.0
- Change the default flag value to ON.
- Update the testcases to be run extended_keys=ON:
  = trivial test result updates
  = If extended_keys setting makes a difference for a testcase, run the testcase 
    with extended_keys=off. There were only a few such cases
- Update to vcol_select_innodb looks like a worse plan but it will be gone in 10.0.
2014-02-25 01:18:13 +04:00
Alexey Botchkov
222e73c7a1 MariaDB Audit plugin added. 2014-02-24 23:40:16 +04:00
Sergei Golubchik
ff2e82f4a1 5.3 merge 2014-02-22 22:51:20 +01:00
Michael Widenius
6efa5efa7d Fixed that rpl_row_create_table can be run with --ps-protocol
As part of the fix we don't anymore generate a create table statement when doing a
CREATE TABLE IF NOT EXISTS table_that_exist LiKE temporary_table
if the 'table_that_exist' existed.

This is because it's not self evident if we should generate a create statement
matching the existing table or the temporary_table. 
The old code generated a table like the existing table in row based replication and like the temporary table
in statement based replication.
It's better to ensure that both cases works the same way.

mysql-test/suite/rpl/r/rpl_row_create_table.result:
  Updated results
  (Now we don't anymore CREATE TABLE IF NOT EXISTS LIKE if the table existed)
sql/sql_base.cc:
  More DBUG_PRINT
sql/sql_error.cc:
  More DBUG_PRINT
sql/sql_table.cc:
  Don't generate a create table statement when doing a
  CREATE TABLE IF NOT EXISTS table_that_exist like temporary_table if the table existed.
2014-02-22 03:11:56 +02:00
Igor Babaev
3e03c9eae9 After constant row substitution the optimizer should call the method
update_used_tables for the the where condition to update cached
indicators of constant subexpressions. It should be done before further
possible simplification of the where condition.

This change caused simplification of the executed where conditions 
in many test cases.
2014-02-20 21:27:33 -08:00
Sergei Golubchik
74feebcd43 MDEV-5624 mysqldump --dump-slave option does not restart the replication if the dump has failed 2014-02-21 00:53:02 +01:00
Sergei Golubchik
62f3552390 MDEV-5609 create new test ssl certificates
Use 20-year ssl certificates for mysql-test from RedHat patch
2014-02-19 21:40:34 +01: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
Alexey Botchkov
84580f950c MDEV-5481 mysqldump fails to dump geometry types properly.
Fixed so the MYSQL_TYPE_GEOMETRY is treated as BLOB.
2014-02-18 17:45:08 +04:00
Alexey Botchkov
820b1a6687 MDEV-5615 crash in Gcalc_function::add_operation.
The result is EMPTY for a buffer(line, -1), but we still
need one FALSE operation to be stored in the condition.
And we actually add it but forgot to alloc memory to store it.
2014-02-18 17:15:25 +04:00
Murthy Narkedimilli
075a2fb716 Updated/added copyright header. Added line "use is subject to license terms"
to copyright header.
2014-02-17 18:19:04 +05:30
Sergei Golubchik
3febb3ce1d mtr: smarter check for usable ipv6.
Handles the case of
sysctl net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1
2014-02-17 11:10:18 +01:00
Sergey Petrunya
b594e31b6b Merge 2014-02-17 18:53:54 +04:00
Sergey Petrunya
df963fd3c7 MDEV-5177: ha_partition and innodb index intersection produce fewer rows (MySQL Bug#70703)
MDEV-5555: Incorrect index_merge on BTREE indices
- In ha_partition, make ordered index reads return rows in rowid order
  when index columns are the same.
2014-02-17 18:50:54 +04:00
Sergei Golubchik
84c96a263e different fix for internal Oracle MySQL bug#16324629 that doesn't crash
(simply, copied from FederatedX)
2014-02-17 11:09:33 +01:00
Sergei Golubchik
4881c65007 test case for
MDEV-5689 ExtractValue(xml, 'substring(/x,/y)') crashes
MySQL bug#12428404 MYSQLD.EXE CRASHES WHEN EXTRACTVALUE() IS CALLED WITH MALFORMED XPATH EXP
2014-02-17 11:09:24 +01:00
Sergei Golubchik
84651126c0 MySQL-5.5.36 merge
(without few incorrect bugfixes and with 1250 files where only a copyright year was changed)
2014-02-17 11:00:51 +01:00
Thirunarayanan B
9ea02a1c09 Bug #18010711 UNIQUE PREFIX INDEX ON BINARY COLUMN:
FAILING ASSERTION: FLEN == LEN

Problem:
       Broken invariant triggered when building a unique index on a
binary column and the input data contains duplicate keys. This was broken
in debug builds only.

Fix:
       Fixed length of the binary datatype can be greater than length of
the shorter prefix on which index is being created.
2014-02-17 13:45:34 +05:30
Sergey Petrunya
ccb54beb6d Merge 2014-02-15 01:26:53 +04:00
Sergey Petrunya
8c9b2f3429 MDEV-5581: Server crashes in in JOIN::prepare on 2nd execution of PS with materialization+semijoin
- The problem was that JOIN::prepare() tried to set TABLE::maybe_null
  for a table in join. Non-merged semi-join tables 1) are present as 
  join's base tables on second EXECUTE, but 2) do not yet have a TABLE 
  object.
  Worked around the problem by putting mixed_implicit_grouping into JOIN
  object, and then passing it to JTBM tables in setup_jtbm_semi_joins().
2014-02-15 01:21:46 +04:00
Sergei Golubchik
1fa5183241 revert revno 4060:
revision-id: monty@askmonty.org-20140211120313-z158i1sdlxxeotgl
  committer: Michael Widenius <monty@askmonty.org>
  message:
    Enable rpl_row_create_table (no reason to keep this disabled anymore)

Still fails (in --ps), no reason to enable it if it is not fixed.
2014-02-14 15:34:23 +01:00
Sergei Golubchik
64f96de766 fix SphinxSE to not leave Sphinx_error status variable uninitialized 2014-02-14 15:16:23 +01:00
Sergei Golubchik
fb27ce22f7 5.3 merge 2014-02-14 14:09:29 +01:00
Sergei Golubchik
5a21dc7df1 fix suite/sphinx/suite.pm to not start searchd twice 2014-02-14 14:08:16 +01:00
Sergei Golubchik
9d5731ef1b fix the test 2014-02-14 11:14:10 +01:00
Sergei Golubchik
8a26d19088 record incorrect result for MDEV-5539 Empty results in UNION with Sphinx engine
(just to have the test in the tree when we merge the upstream fix)
2014-02-14 10:39:25 +01:00
Sergei Golubchik
12253abadb MDEV-714 LP:1020645 - crash (sig 11) with union query
Don't ignore the error from st_select_lex_unit::optimize()
2014-02-13 20:21:57 +01:00
Sergei Golubchik
4b57720caa use a different error for MySQL bug#11747970 - kill the query,
as it was supposed to be in bug#11747970, don't fake an error.
(this kill can be useful for other bugs too)
2014-02-13 20:20:17 +01:00
Sergey Vojtovich
e2a99f1863 MDEV-5616 - Deadlock between CREATE/DROP FUNCTION and SELECT from view
Deadlock happened due to mixed lock order.
CREATE/DROP function: wrlock(THR_LOCK_udf) -> lock(LOCK_open)
SELECT from view: lock(LOCK_open) -> rdlock(THR_LOCK_udf)

Fixed CREATE/DROP function so that LOCK_open does not intersect with
wrlock(THR_LOCK_udf).

10.0 is not affected: it doesn't hold LOCK_open while opening view.
2014-02-13 16:41:08 +04:00
Sergei Golubchik
913beda8c8 5.2 merge 2014-02-13 10:15:03 +01:00
Sergey Petrunya
5611c0e29d Merge 2014-03-11 17:14:48 +01:00
Sergey Petrunya
cb5b6c7e39 MDEV-5177: ha_partition and innodb index intersection produce fewer rows (MySQL Bug#70703)
(This is attempt at fix #2) (re-commit with fixed typo)
- Moved the testcase from partition_test to partition_innodb.test where it can really work.
- Made ordered index scans over ha_partition tables to satisfy ROR property for 
  the case where underlying table uses extended keys.
2014-03-11 16:45:08 +01:00
Michael Widenius
f031f0ae67 Fixed test failure (5.5 had different test result than 10.0) 2014-03-11 17:37:46 +02:00
Sergei Golubchik
48445f3556 5.1 merge 2014-02-13 08:25:33 +01:00
Sergey Vojtovich
fd1437dfe5 MDEV-5597 - Reduce usage of LOCK_open: LOCK_flush
Replaced LOCK_flush with per-share conditional variable.
2014-02-13 11:13:55 +04:00
Sergei Golubchik
5f5d2db141 fix embedded tests
(mainly by backporting 5.5. changes)

mysql-test/suite/maria/t/distinct.test:
  Remove the test that requires SSL. One test case for a bug is enough.
sql/scheduler.cc:
  make it the same as in 5.5
storage/innodb_plugin/row/row0mysql.c:
  make it the same as in 5.5
storage/innodb_plugin/row/row0sel.c:
  make it the same as in 5.5
storage/xtradb/row/row0mysql.c:
  make it the same as in 5.5
storage/xtradb/row/row0sel.c:
  make it the same as in 5.5
2014-02-13 08:09:07 +01:00
Sergei Golubchik
52f038c5c3 MDEV-5655 Server crashes on NAME_CONST containing AND/OR expressions
fix the NAME_CONST check to only allow literals, negated literals, and literals with
the explicit collation.
2014-02-12 21:17:28 +01: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
unknown
528df1df45 MDEV-5505: Assertion `! is_set()' fails on PREPARE SELECT with out of range in GROUP BY
Fixed error processing in find_order_in_list(): if an error reported to user there is no sens to continue.
2014-02-12 17:07:05 +02:00
Neeraj Bisht
e13b28afdf Bug#17075846 - UNQUOTED FILE NAMES FOR VARIABLE VALUES ARE
ACCEPTED BUT PARSED INCORRECTLY

When we are setting the value in a system variable, 
We can set it like 

set sys_var="Iden1.Iden2";		//1
set sys_var='Iden1.Iden2';		//2
set sys_var=Iden1.Iden2;		//3
set sys_var=.ident1.ident2; 		//4
set sys_var=`Iden1.Iden2`;		//5


While parsing, for case 1(when ANSI_QUOTES is enable) and 2,
we will take as string literal(we will make item of type Item_string).
for case 3 & 4, taken as Item_field, where Iden1 is a table name and
iden2 is a field name.
for case 5, again Item_field type, where iden1.iden2 is taken as
field name.


Now in case 1, when we are assigning some value to system variable
(which can take string or enumerate type data), we are setting only 
field part.
This means only iden2 value will be set for system variable. This 
result in wrong result.

Solution:

(for string type) We need to Document that we are not allowed to set 
system variable which takes string as identifier, otherwise result 
in unexpected behaviour.

(for enumerate type)
if we pass iden1.iden2, we will give an error ER_WRONG_TYPE_FOR_VAR
(Incorrect argument type to variable).

mysql-test/suite/sys_vars/t/general_log_file_basic.test:
  Earlier we used to give ER_WRONG_VALUE_FOR_VAR error, but in the patch of
  (Bug32748-Inconsistent handling of assignments to general_log_file/slow_query_log_file)
  they quoted this line.But i am not able to find any relation of this with the changes of
  patch. So i think We should give error in this case.
mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test:
  Earlier we used to give ER_WRONG_VALUE_FOR_VAR error, but in the patch of
  (Bug32748-Inconsistent handling of assignments to general_log_file/slow_query_log_file)
  they quoted this line.But i am not able to find any relation of this with the changes of
  patch. So i think We should give error in this case.
2014-02-12 14:33:56 +05:30
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
103643d87a Changed " to ' around connection name (safer) 2014-02-12 00:06:44 +02:00
Michael Widenius
3474bb04ec Fixed that --apply-slave-statements also uses multi-source
mysql-test/r/rpl_mysqldump_slave.result:
  Updated test result
2014-02-11 23:41:56 +02:00
Michael Widenius
55829ac13d Support 6 digit version numbers in executable comment syntax.
This is needed to be able to ignore executable comments from version 10.0.
2014-02-11 21:43:08 +02:00
Michael Widenius
3f4337103a Automatic merge 2014-02-11 19:45:38 +02:00
Michael Widenius
add6eb69a8 Fixed MDEV-4551: mysqldump --dump-slave fails with multi-source replication
When running with multi-source enabled master (MariaDB 10.0) all master will be recorded

mysql-test/r/rpl_mysqldump_slave.result:
  Updated results to new syntax
2014-02-11 19:42:18 +02:00
Michael Widenius
94d23e2413 Fixed MDEV-3815: Aria engine return "The table is full" (ERROR 1114) inserting record, while MyISAM and InnoDB doesn't
Increase default pointer length for Aria tables to be able to handle big files without having to specify MAX_ROWS


mysql-test/suite/maria/icp.result:
  Updated result
mysql-test/suite/maria/maria-preload.result:
  More pages are needed with longer pointer length
mysql-test/suite/maria/maria.result:
  Added more tests
mysql-test/suite/maria/maria.test:
  Added more tests
storage/maria/ma_create.c:
  Increase default pointer length for Aria tables to be able to handle big files without having to specify MAX_ROWS
storage/maria/ma_range.c:
  Optimize records_in_range() to be more exact
storage/maria/ma_static.c:
  Increase default pointer size
storage/maria/ma_test2.c:
  Allow a bit larger errors in records_in_range
2014-02-11 19:40:33 +02:00
Michael Widenius
50323f1263 Fixed test case as gtid events are not counted anymore 2014-02-11 18:45:49 +02:00
Michael Widenius
e068197ca3 Fixed wrong result file 2014-02-11 18:08:02 +02:00
Michael Widenius
1bdf2151da Fixed MDEV-5617: mysqld crashes when running a query with ONLY_FULL_GROUP_BY
Problem was that we used cache_table in some cases where it was not initialized

mysql-test/r/func_group.result:
  Added test case
mysql-test/t/func_group.test:
  Added test case
sql/item.cc:
  Don't use cached_table if not set
sql/item_sum.cc:
  Don't use cached_table
2014-02-11 16:58:49 +02:00
Michael Widenius
2d48e9f11c Fixed failing test case 2014-02-11 16:57:28 +02:00
Michael Widenius
67e8e926e9 Set default progress report time to 5 seconds
(Had accidently been set to 56 seconds in some merge)


sql/sys_vars.cc:
  Set default progress report time to 5 seconds
2014-02-11 16:56:38 +02:00
unknown
34bd0d02ba Merge 10.0-base -> 10.0 2014-02-11 14:21:48 +01:00
unknown
cc7925765e MDEV-4937: sql_slave_skip_counter does not work with GTID
As a side-effect of purge_relay_logs(), sql_slave_skip_counter
was silently ignored in GTID mode.

But sql_slave_skip_counter in fact is not a good match with GTID.
And it is not really needed either, as users can explicitly set
@@gtid_slave_pos to skip specific GTIDs, in a way that matches
well how GTID replication works.

So with this patch, we give an error on attempts to set
sql_slave_skip_counter when using GTID, with a suggestion to use
gtid_slave_pos instead, if needed.
2014-02-11 14:06:03 +01:00
Michael Widenius
5785b1a05c Enable rpl_row_create_table (no reason to keep this disabled anymore) 2014-02-11 14:03:13 +02:00
Michael Widenius
12bbf03cff Fix for MDEV-5629: Failing assertion: state == TRX_STATE_NOT_STARTED on concurrent CREATE OR REPLACE and transactional UPDATE
mysql-test/suite/innodb/r/row_lock.result:
  Test case for MDEV-5629
mysql-test/suite/innodb/t/row_lock.test:
  Test case for MDEV-5629
sql/filesort.cc:
  Don't call unlock_row() in case of errors
2014-02-11 14:02:42 +02:00
sayantan dutta
cebe93dc5b Bug #18027288 - MTR SUITE ABORTS WHEN A CLIENT TRIES TO CONNECT SERVER WITH A WRONG PORT NUMBER 2014-02-11 17:15:50 +05:30
Annamalai Gurusami
6193c63211 Bug#18185930 UPD_NODE_INSERT_BLOB CAUSES BTR_EXTERN_OWNER_FLAG ASSERTION
Problem:

In the clustered index, when an update operation is done the overall
scenario (after rb#4479) is as follows:

1.  Delete mark the old record that is to be updated.
2.  The old record disowns the blobs.
3.  Insert the new record into clustered index.
4.  For non-updated blobs, new record must own it. Verified by assert.
5.  For non-updated blobs, in new record marked as inherited.

Scenario involving DB_LOCK_WAIT:

If step 3 times out, then we will skip 1 and 2 and will continue from
step 3.  This skipping is achieved by the UPD_NODE_INSERT_BLOB state.
In this case, step 4 is not correct.  Because of step 1, the new
record need not own the blobs.  Hence the assert failure.

Solution:

The assert in step 4 is removed.  Instead code is added to ensure that
the record owns the blob.  

Note:

This is a regression caused by rb#4479.

rb#4571 approved by Marko
2014-02-11 16:44:37 +05:30
Igor Babaev
f17079fa7e Merge 5.3->5.5 2014-02-10 17:00:51 -08:00