Commit graph

65739 commits

Author SHA1 Message Date
Sergey Petrunya
b76a8595c6 Re-initialization reworked 2010-11-01 13:52:10 +03:00
Sergey Glukhov
930cf09ec7 test case fix 2010-11-01 09:47:57 +03:00
Sergey Petrunya
430f63c271 use DBUG_RETURN with DBUG_ENTER 2010-11-01 00:04:34 +03:00
Sergey Petrunya
d9a8dd22b2 DS-MRR/CPK improvements: correct buffer exhaustion handling 2010-10-31 22:00:15 +03:00
Igor Babaev
df32342102 Fixed LP bug #668290.
Prohibited to use hash join algorithm BNLH if join attributes
need non-binary collations. It has to be done because BNLH does
not support join for such attributes yet.
Later this limitations will be lifted.

Changed default collations for the schemes of some test cases
to preserve the old execution plans.
2010-10-30 15:14:36 -07:00
Sergei Golubchik
5789f96c62 fix LIKE in a vcol function, broken by a fix for mysql bug#54568.
don't set view_prepare_mode when opening a base table
(either in SHOW CREATE or in I_S.TABLES)
2010-10-30 19:54:38 +02:00
Igor Babaev
0b72fd88a1 Merge. 2010-10-30 06:07:45 -07:00
Igor Babaev
d48a8b6034 Fixed bug #665049.
The bug could cause wrong results for queries over Maria tables when
index condition pushdown was used.
2010-10-29 18:59:39 -07:00
Sergei Golubchik
310584a849 merge w/ 5.1 2010-10-29 23:18:02 +02:00
Sergei Golubchik
716f784375 sane implementation of Key_% status variables. 2010-10-29 20:29:43 +02:00
Sergey Petrunya
8e4c627ef8 DS-MRR improvements:
- Correct buffer re-allocation
2010-10-29 20:21:26 +04:00
Georgi Kodinov
d89c7a82e0 merge 2010-10-29 14:04:13 +03:00
Georgi Kodinov
fd46de026d merge to 5.1-security 2010-10-29 14:02:49 +03:00
Georgi Kodinov
64044fdf19 merge to 5.1-security 2010-10-29 13:06:21 +03:00
Georgi Kodinov
33ec6f801b merge to 5.0-security 2010-10-29 13:05:24 +03:00
Sergey Petrunya
1e82320d27 DS-MRR improvements
- buildbot test failure fixes: don't try to get more records from SimpleIndexReader
  if we've already got EOF for it.
2010-10-29 13:42:48 +04:00
Sergey Glukhov
4a23ac20d9 Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
Lines below which were added in the patch for Bug#56814 cause this crash:

+      if (table->table)
+        table->table->maybe_null= FALSE;

Consider following test case:
--
CREATE TABLE t1(f1 INT NOT NULL);
INSERT INTO t1 VALUES (16777214),(0);

SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;

DROP TABLE t1;
--

We set TABLE::maybe_null to FALSE for t2 table
and in create_tmp_field() we create appropriate tmp table field
using create_tmp_field_from_item() function instead of
create_tmp_field_from_field. As a result we have
LONGLONG field. As we have GROUP BY clause we calculate
group buffer length, see calc_group_buffer().
Item from group list which is used for calculation
refer to the field from real tables and have LONG type.
So group buffer length become insufficient for storing of
LONGLONG value. It leads to overwriting of wrong memory
area in do_field_int() function which is called from
end_update().
After some investigation I found out that
create_tmp_field_from_item() is used only for OLAP
grouping and can not be used for common grouping
as it could be an incompatibility between tmp
table fields and group buffer length.
We can not remove create_tmp_field_from_item() call from
create_tmp_field as OLAP needs it and we can not use this
function for common grouping. So we should remove setting
TABLE::maybe_null to FALSE from simplify_joins().
In this case we'll get wrong behaviour of
list_contains_unique_index() back. To fix it we
could use Field::real_maybe_null() check instead of
Field::maybe_null() and add addition check of
TABLE_LIST::outer_join.


mysql-test/r/group_by.result:
  test case
mysql-test/r/join_outer.result:
  test case
mysql-test/t/group_by.test:
  test case
mysql-test/t/join_outer.test:
  test case
sql/sql_select.cc:
  --remove wrong code
  --use Field::real_maybe_null() check instead of
    Field::maybe_null() and add addition check of
    TABLE_LIST::outer_join
2010-10-29 12:23:06 +04:00
unknown
c6b19ea001 mysqltest: Fix reversed error check, causing truncated output when testcase fails.
Also fix missing zero termination in DBUG_PRINT, causing garbage output
in --debug output.
2010-10-29 09:56:45 +02:00
Vasil Dimov
23552ecd41 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-10-29 10:45:11 +03:00
Sergey Glukhov
c04bf683fe Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
The problem is caused by bug49487 fix and became visible
after after bug56679 fix.
Items are cleaned up and set to unfixed state after filling derived table.
So we can not rely on item::fixed state in Item_func_group_concat::print
and we can not use 'args' array as items there may be cleaned up.
The fix is always to use orig_args array of items as it
always should contain the correct data.


mysql-test/r/func_gconcat.result:
  test case
mysql-test/t/func_gconcat.test:
  test case
sql/item_sum.cc:
  The fix is always to use orig_args array of items.
2010-10-29 11:44:32 +04:00
Igor Babaev
05092b7323 Post-merge adjustment of the results for the innodb_plugin test suite. 2010-10-28 13:51:50 -07:00
Sergei Golubchik
8e7ebfbce8 5.2 merge 2010-10-28 19:04:23 +02:00
Sergey Petrunya
a88bd5cf56 DS-MRR improvements:
- address the review feedback (class/var renames)
- fix wrong test result (bug in buffer refill logic)
2010-10-28 20:48:16 +04:00
Calvin Sun
460ad14e04 Bug#52062: Compiler warning in os0file.c on windows 64-bit
On Windows, the parameter for number of bytes passed into WriteFile()
and ReadFile() is DWORD. Casting is needed to silence the warning on
64-bit Windows.

Also, adding several asserts to ensure the variable for number of bytes
is no more than 32 bits, even on 64-bit Windows.

This is for InnoDB Plugin.

rb://415
Approved by: Inaam
2010-10-28 00:10:28 -05:00
Calvin Sun
16feea4109 Bug#52062: Compiler warning in os0file.c on windows 64-bit
On Windows, the parameter for number of bytes passed into WriteFile()
and ReadFile() is DWORD. Casting is needed to silence the warning on
64-bit Windows.

Also, adding several asserts to ensure the variable for number of bytes
is no more than 32 bits, even on 64-bit Windows.

This is for built-in InnoDB.

rb://415
Approved by: Inaam
2010-10-27 23:18:59 -05:00
Igor Babaev
4292c59089 Merge 2010-10-27 16:37:33 -07:00
Igor Babaev
8d8170f1a4 Changed properties changed: +x to -x 2010-10-27 16:35:00 -07:00
Igor Babaev
4f75a8254a Merge 5.3-mwl128 -> 5.3 2010-10-27 16:31:22 -07:00
Sergey Glukhov
c7371c9e75 Bug#57477 SIGFPE when dividing a huge number a negative number
The problem is dividing by const value when
the result is out of supported range.
The fix:
-return LONGLONG_MIN if the result is out of supported range for DIV operator.
-return 0 if divisor is -1 for MOD operator.


mysql-test/r/func_math.result:
  test case
mysql-test/t/func_math.test:
  test case
sql/item_func.cc:
  -return LONGLONG_MIN if the result is out of supported range for DIV operator.
  -return 0 if divisor is -1 for MOD operator.
2010-10-27 18:12:10 +04:00
Vasil Dimov
4bf273c8f1 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-10-27 16:39:22 +03:00
unknown
3bdede3c67 Fixed LP bug #613009
The set of Ordered keys of a rowid merge engine is dense. Thus when
we decide not to create a key for a column that has only NULLs, this
column shouldn't be counted.

Notice that the caller has already precomputed the correct total
number of keys that should be created.
2010-10-27 16:28:19 +03:00
unknown
3b11e4f834 Fixed LP bug #609121
Post-review fix - avoid re-evaluation of the having clause
when it evaluates to true.
2010-10-27 12:35:15 +03:00
unknown
4cb9a326cf Fix test failure (timeout) in --valgrind tests in Buildbot.
The main.ps_ddl test does SELECT * FROM mysql.general_log; that can be really
expensive with --valgrind if previous test cases put lots of data in the
general log since last server restart. Fix by truncating the log at test start.
2010-10-27 10:41:45 +02:00
Anitha Gopi
fcfda43ca3 Fixed bug numbers in disabled.def files 2010-10-27 09:54:04 +05:30
unknown
a09e5f504a Type of the variables fixed.
sql/sql_expression_cache.cc:
  Type of the variable fixed.
sql/sql_expression_cache.h:
  Type of the variable fixed.
2010-10-27 06:03:59 +03:00
Inaam Rana
26738c280f Bug #57611 ibdata file and continuous growing undo logs
rb://498

Fix handling of update_undo_logs at trx commit. Previously, when
rseg->update_undo_list grows beyond 500 the update_undo_logs were
marked with state TRX_UNDO_TO_FREE which should have been
TRX_UNDO_TO_PURGE.

Approved by: Sunny Bains
2010-10-26 16:54:18 -04:00
unknown
b4d5f30a86 Fixed LP bug #601156
The cause for this bug is that MariaDB 5.3 still processes derived tables
(subqueries in the FROM clause) by fully executing them during the parse
phase. This will be remedied by MWL#106 once merged into the main 5.3.

The assert statement is triggered when MATERIALIZATION is ON for EXPLAIN
EXTENDED for derived tables with an IN subquery as follows:
- mysql_parse calls JOIN::exec for the derived table as if it is regular
  execution (not explain).
- When materialization is ON, this call goes all the way to
  subselect_hash_sj_engine::exec, which creates a partial match engine
  because of NULL presence.
- In order to proceed with normal execution, the hash_sj engine substitutes
  itself with the created partial match engine.
- After the parse phase it turns out that this execution was part of
  EXPLAIN EXTENDED, which in turn calls
  Item_cond::print -> ... -> Item_subselect::print,
  which calls engine->print().
  Since subselect_hash_sj_engine::exec substituted the current
  Item_subselect engine with a  partial match engine, eventually we call
  its ::print() method. However the partial match engines are designed only
  for execution, hence there is no implementation of this print() method.

The fix temporarily removes the assert, until this code is merged with
MWL#106.
2010-10-26 14:55:42 +03:00
Sergey Petrunya
d8efc3b155 DS-MRR improvements: address review feedback for R3 version of the patch 2010-10-26 15:35:13 +04:00
Sergei Golubchik
7c24e8d54d fixes for windows 2010-10-26 07:37:44 +02:00
unknown
db4738a18a Fixed LP bug #609121
The bug was a result of missing logic to handle the case
when there are 'expensive' predicates that are not evaluated
during constant table optimization. Such is the case for
the IN predicate, which is considered expensive if it is
computed via materialization. In general this bug can be
triggered with any expensive predicate instead of IN.

When FALSE constant predicates are not evaluated during constant
optimization, the execution path changes so that instead of
setting JOIN::zero_result_cause after make_join_select, and
exiting JOIN::exec via the call to return_zero_rows(), execution
ends in JOIN::exec in the branch:
if (join->tables == join->const_tables)
{
  ...
  else if (join->send_row_on_empty_set())
     ...
     rc= join->result->send_data(*columns_list);
}
Unlike return_zero_rows(), this branch didn't evaluate the
having clause of the query.

The patch adds a call to evaluate the HAVING clause of a query even
when all tables are constant, because even for an empty result set
some aggregate functions may produce a NULL value.
2010-10-25 23:48:43 +03:00
Bjorn Munch
676e012e47 merge from 5.1-mtr 2010-10-25 15:48:41 +02:00
Sergei Golubchik
04a4b43346 merge with 5.1 2010-10-25 15:21:16 +02:00
Sergei Golubchik
37a78d6868 forgotten option handled 2010-10-25 09:04:40 +02:00
Jimmy Yang
112684b0ba Fix bug #57700 Latching order violation in row_truncate_table_for_mysql().
Approved by Sunny Bains
2010-10-24 22:51:21 -07:00
Jimmy Yang
ed2e88e66c Fix bug #57700 Latching order violation in row_truncate_table_for_mysql().
Approved by Sunny Bains
2010-10-24 20:31:51 -07:00
Igor Babaev
0c53cd1ec9 Fixed LP bug #664508.
When join buffers are employed no index scan for the first
table with grouping columns can be used.



mysql-test/r/join_cache.result:
  Added a test case for bug #664508.
  Sorted results for some other test cases.
mysql-test/t/join_cache.test:
  Added a test case for bug #664508.
  Sorted results for some other test cases.
2010-10-24 14:22:01 -07:00
Sergei Golubchik
62d31f675d bugfix: engine defined table options were not showing up in INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS 2010-10-24 20:47:01 +02:00
unknown
06c49d571b Bug#27606 GRANT statement should be replicated with DEFINER information
"Grantor" columns' data is lost when replicating mysql.tables_priv.
Slave SQL thread used its default user ''@'' as the grantor of GRANT|REVOKE
statements executing on it.

In this patch, current user is put in query log event for all GRANT and REVOKE
statement, SQL thread uses the user in query log event as grantor.


mysql-test/suite/rpl/r/rpl_do_grant.result:
  Add test for this bug.
mysql-test/suite/rpl/t/rpl_do_grant.test:
  Add test for this bug.
sql/log_event.cc:
  Refactoring THD::current_user_used and related functions.
  current_user_used is used to judge if current user should be
  binlogged in query log event. So it is better to call it m_binlog_invoker.
  The related functions are renamed too.
sql/sql_class.cc:
  Refactoring THD::current_user_used and related functions.
  current_user_used is used to judge if current user should be
  binlogged in query log event. So it is better to call it m_binlog_invoker.
  The related functions are renamed too.
sql/sql_class.h:
  Refactoring THD::current_user_used and related functions.
  current_user_used is used to judge if current user should be
  binlogged in query log event. So it is better to call it m_binlog_invoker.
  The related functions are renamed too.
sql/sql_parse.cc:
  Call binlog_invoker() for GRANT and REVOKE statements.
2010-10-23 20:55:44 +08:00
Igor Babaev
de69dbae0c Fixed LP bug #663818.
After the patch for bug 663840 had been applied the test case for
bug 663818 triggered the assert introduced by this patch.
It happened because the the patch turned out to be incomplete:
the space needed for a key entry must be taken into account
for the record written into the buffer, and, for the next record
as well, when figuring out whether the record being written is
the last for the buffer or not.
2010-10-22 15:30:47 -07:00
Igor Babaev
ca862231f7 Fixed LP bug #663840.
When adding a new record into the join buffer that is employed by
BNLH join algorithm the writing procedure JOIN_CACHE::write_record_data 
checks whether there is enough space for the record in the buffer.
When doing this it must take into account a possible new key entry
added to the buffer. It might happen, as it has been demonstrated by
the bug test case, that there is enough remaining space in the buffer
for the record, but not for the additional key entry for this record.
In this case the key entry overwrites the end of the record that might
cause a crash or wrong results.
Fixed by taking into account a possible addition of new key entry when
estimating the remaining free space in the buffer.
2010-10-22 10:53:29 -07:00