developers
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 8 participants
- 6868 discussions

[Maria-developers] Updated (by Timour): Subquery optimization: Efficient NOT IN execution with NULLs (68)
by worklog-noreply@askmonty.org 04 Dec '09
by worklog-noreply@askmonty.org 04 Dec '09
04 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Efficient NOT IN execution with NULLs
CREATION DATE..: Fri, 27 Nov 2009, 13:22
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Benchmarks-3.0
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Fri, 04 Dec 2009, 11:26)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.5182 2009-12-04 11:26:25.000000000 +0200
+++ /tmp/wklog.68.new.5182 2009-12-04 11:26:25.000000000 +0200
@@ -50,23 +50,39 @@
The array can be created on demand.
Other consideration that may be taken into account:
+
1. If columns a_j1,...,a_jm do not contain null values in the temporary
-table at all, create for them only one index array (and of course do not
-create any bitmaps for them).
-2. Consider the ratio d(a_i)=N'/ V(a_i), where N' is the number of rows
-where a_i is not null and V(a_i) is the number of distinct values for
-a_i excluding nulls.
- If d(a_i) is close to 1 then do not create any index array: check
+table at all and v_j1,...,v_jm cannot be null, create for these columns
+only one index array (and of course do not create any bitmaps for them).
+
+2. Consider the ratio d(a_i)=N'(a_i)/V(a_i), where N'(a_i) is the number
+of rows, where a_i is not null and V(a_i) is the number of distinct
+values for a_i excluding nulls.
+If d(a_i) is close to N'(a_i) then do not create any index array: check
whether there is a match running through the records that have been
-filtered in. Anyway if d(a_i) is close to 1 then a intersection with
-rowid{a_i=v_i} would not reduce the number of remaining rowids
+filtered in. Anyway if d(a_i) is close to N'(a_i) then the intersection
+ with rowid{a_i=v_i} will not reduce the number of remaining rowids
significantly.
- If additionally N-N' is small do not create a bitmap for this column
-either.
-3. If for a column a_i d(a_i) is not close to 1, but N-N' is small a
-sorted array of rowids from the set rowid{a_i is null} can be used
-instead of a bitmap.
+In other words is V(a_i) exceeds some threshold there is no sense to
+create an index for a_i.
+If additionally N-N'(a_i) is small do not create a bitmap for this
+column either.
+
+3. If for a column a_i d(a_i) is not close to N'(a_i), but N-N'(a_i) is
+small a sorted array of rowids from the set rowid{a_i is null} can be
+used instead of a bitmap.
+
4. We always have a match if R0= INTERSECT rowid{a_i is null} is not
empty. Here i runs through all indexes from [1..n] such that v_i is not
null. For a given subset of columns this fact has to be checked only
once. It can be easily done with bitmap intersection.
+
+5. If v1,...,vn never can be a null, then indexes (sorted arrays) can be
+created only for rows with nulls.
+
+6. If v1,...,vn never can be a null and number of rows with nulls is
+small do not create indexes and do not create bitmaps.
+
+7. If you get a row with nulls in all columns stop filling the temporary
+table and return UNKNOWN for any tuple <v1,...,vn>.
+
-=-=(Timour - Fri, 27 Nov 2009, 13:23)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.17140 2009-11-27 11:23:17.000000000 +0000
+++ /tmp/wklog.68.new.17140 2009-11-27 11:23:17.000000000 +0000
@@ -1 +1,72 @@
+This a copy of the initial algorithm proposed by Igor:
+======================================================
+For each left side tuple (v_1,...,v_n) we have to find the following set
+of rowids for the temp table containing N rows as the result of
+materialization of the subquery:
+
+ R= INTERSECT (rowid{a_i=v_i} UNION rowid{a_i is null} where i runs
+trough all indexes from [1..n] such that v_i is not null.
+
+Bear in mind the following specifics of this intersection:
+ (1) For each i: rowid{a_i=v_i} and rowid{a_i is null} are disjoint
+ (2) For each i: rowid{a_i is null} is the same for each tuple
+
+Due to (2) it makes sense to build rowid{a_i is null} only once.
+A good representation for such sets would be bitmaps:
+- it requires minimum memory: not more than N*n bits in total
+- search of an element in a set is extremely cheap
+
+Taken all above into account I could suggest the following algorithm to
+build R:
+
+ Using indexes (read about them below) for each column participating in the
+ intersection,
+ merge ordered sets rowid{a_i=v_i} in the following manner.
+ If a rowid r has been encountered maximum in k sets
+rowid{a_i1=v_i1},...,rowid(a_ik=v_ik),
+ then it has to be checked against all rowid{a_i=v_i} such that i is
+not in {i1,...,ik}.
+ As soon as we fail to find r in one of these sets we discard it.
+ If r has been found in all of them then r belongs to the set R.
+
+Here we use the property (1): any r from rowid{a_i=v_i} UNION rowid{a_i
+is null} is either
+belongs to rowid{a_i=v_i} or to rowid{a_i is null}. From this we can
+infer that for any r from R
+indexes a_i can be uniquely divided into two groups: one contains
+indexes a_i where r belongs to
+the sets rowid{a_i=v_i}, the other contains indexes a_j such that r
+belongs to rowid{a_j is null}.
+
+Now let's talk how to get elements from rowid{a_i=v_i} in a sorted order
+needed for the merge procedure. We could use BTREE indexes for temp
+table. But they are rather expensive and
+take a lot of memory as the are implemented with RB trees.
+I would suggest creating for each column from the temporary table just
+an array of rowids sorted by the value from column a.
+Index lookup in such an array is cheap. It's also rather cheap to check
+that the next rowid refers to a row with a different value in column a.
+The array can be created on demand.
+
+Other consideration that may be taken into account:
+1. If columns a_j1,...,a_jm do not contain null values in the temporary
+table at all, create for them only one index array (and of course do not
+create any bitmaps for them).
+2. Consider the ratio d(a_i)=N'/ V(a_i), where N' is the number of rows
+where a_i is not null and V(a_i) is the number of distinct values for
+a_i excluding nulls.
+ If d(a_i) is close to 1 then do not create any index array: check
+whether there is a match running through the records that have been
+filtered in. Anyway if d(a_i) is close to 1 then a intersection with
+rowid{a_i=v_i} would not reduce the number of remaining rowids
+significantly.
+ If additionally N-N' is small do not create a bitmap for this column
+either.
+3. If for a column a_i d(a_i) is not close to 1, but N-N' is small a
+sorted array of rowids from the set rowid{a_i is null} can be used
+instead of a bitmap.
+4. We always have a match if R0= INTERSECT rowid{a_i is null} is not
+empty. Here i runs through all indexes from [1..n] such that v_i is not
+null. For a given subset of columns this fact has to be checked only
+once. It can be easily done with bitmap intersection.
DESCRIPTION:
The goal of this task is to implement efficient execution of NOT IN
subquery predicates of the form:
<oe_1,...,oe_n> NOT IN <non_correlated subquery>
when either some oe_i, or some subqury result column contains NULLs.
The problem with such predicates is that it is possible to use index
lookups only when neither argument of the predicate contains NULLs.
If some argument contains a NULL, then due to NULL semantics, it
plays the role of a wildcard. If we were to use regular index lookups,
then we would get 'no match' for some outer tuple (thus the predicate
evaluates to FALSE), while the SQL semantics means 'partial match', and
the predicate should evaluate to NULL.
This task implements an efficient algorithm to compute such 'parial
matches', where a NULL matches any value.
HIGH-LEVEL SPECIFICATION:
This a copy of the initial algorithm proposed by Igor:
======================================================
For each left side tuple (v_1,...,v_n) we have to find the following set
of rowids for the temp table containing N rows as the result of
materialization of the subquery:
R= INTERSECT (rowid{a_i=v_i} UNION rowid{a_i is null} where i runs
trough all indexes from [1..n] such that v_i is not null.
Bear in mind the following specifics of this intersection:
(1) For each i: rowid{a_i=v_i} and rowid{a_i is null} are disjoint
(2) For each i: rowid{a_i is null} is the same for each tuple
Due to (2) it makes sense to build rowid{a_i is null} only once.
A good representation for such sets would be bitmaps:
- it requires minimum memory: not more than N*n bits in total
- search of an element in a set is extremely cheap
Taken all above into account I could suggest the following algorithm to
build R:
Using indexes (read about them below) for each column participating in the
intersection,
merge ordered sets rowid{a_i=v_i} in the following manner.
If a rowid r has been encountered maximum in k sets
rowid{a_i1=v_i1},...,rowid(a_ik=v_ik),
then it has to be checked against all rowid{a_i=v_i} such that i is
not in {i1,...,ik}.
As soon as we fail to find r in one of these sets we discard it.
If r has been found in all of them then r belongs to the set R.
Here we use the property (1): any r from rowid{a_i=v_i} UNION rowid{a_i
is null} is either
belongs to rowid{a_i=v_i} or to rowid{a_i is null}. From this we can
infer that for any r from R
indexes a_i can be uniquely divided into two groups: one contains
indexes a_i where r belongs to
the sets rowid{a_i=v_i}, the other contains indexes a_j such that r
belongs to rowid{a_j is null}.
Now let's talk how to get elements from rowid{a_i=v_i} in a sorted order
needed for the merge procedure. We could use BTREE indexes for temp
table. But they are rather expensive and
take a lot of memory as the are implemented with RB trees.
I would suggest creating for each column from the temporary table just
an array of rowids sorted by the value from column a.
Index lookup in such an array is cheap. It's also rather cheap to check
that the next rowid refers to a row with a different value in column a.
The array can be created on demand.
Other consideration that may be taken into account:
1. If columns a_j1,...,a_jm do not contain null values in the temporary
table at all and v_j1,...,v_jm cannot be null, create for these columns
only one index array (and of course do not create any bitmaps for them).
2. Consider the ratio d(a_i)=N'(a_i)/V(a_i), where N'(a_i) is the number
of rows, where a_i is not null and V(a_i) is the number of distinct
values for a_i excluding nulls.
If d(a_i) is close to N'(a_i) then do not create any index array: check
whether there is a match running through the records that have been
filtered in. Anyway if d(a_i) is close to N'(a_i) then the intersection
with rowid{a_i=v_i} will not reduce the number of remaining rowids
significantly.
In other words is V(a_i) exceeds some threshold there is no sense to
create an index for a_i.
If additionally N-N'(a_i) is small do not create a bitmap for this
column either.
3. If for a column a_i d(a_i) is not close to N'(a_i), but N-N'(a_i) is
small a sorted array of rowids from the set rowid{a_i is null} can be
used instead of a bitmap.
4. We always have a match if R0= INTERSECT rowid{a_i is null} is not
empty. Here i runs through all indexes from [1..n] such that v_i is not
null. For a given subset of columns this fact has to be checked only
once. It can be easily done with bitmap intersection.
5. If v1,...,vn never can be a null, then indexes (sorted arrays) can be
created only for rows with nulls.
6. If v1,...,vn never can be a null and number of rows with nulls is
small do not create indexes and do not create bitmaps.
7. If you get a row with nulls in all columns stop filling the temporary
table and return UNKNOWN for any tuple <v1,...,vn>.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Rev 2775: Fix for maria BUG#491097. in file:///home/bell/maria/bzr/work-maria-5.1-test/
by sanja@askmonty.org 03 Dec '09
by sanja@askmonty.org 03 Dec '09
03 Dec '09
At file:///home/bell/maria/bzr/work-maria-5.1-test/
------------------------------------------------------------
revno: 2775
revision-id: sanja(a)askmonty.org-20091203210748-x0t8m9pim0x20s7g
parent: monty(a)askmonty.org-20091201160902-a3iq6lw82xbto9yp
committer: sanja(a)askmonty.org
branch nick: work-maria-5.1-test
timestamp: Thu 2009-12-03 23:07:48 +0200
message:
Fix for maria BUG#491097.
Unlock tables before sending OK to client.
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h 2009-11-16 20:49:51 +0000
+++ b/sql/mysql_priv.h 2009-12-03 21:07:48 +0000
@@ -796,6 +796,7 @@
void cleanup_items(Item *item);
class THD;
void close_thread_tables(THD *thd);
+void unlock_thread_tables(THD *thd);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables);
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-11-30 21:37:27 +0000
+++ b/sql/sql_base.cc 2009-12-03 21:07:48 +0000
@@ -1213,6 +1213,33 @@
}
+/**
+ Unlocks tables in thd->lock()
+
+
+ @param thd Thread handler
+*/
+
+void unlock_thread_tables(THD *thd)
+{
+ if (thd->lock)
+ {
+ /*
+ For RBR we flush the pending event just before we unlock all the
+ tables. This means that we are at the end of a topmost
+ statement, so we ensure that the STMT_END_F flag is set on the
+ pending event. For statements that are *inside* stored
+ functions, the pending event will not be flushed: that will be
+ handled either before writing a query log event (inside
+ binlog_query()) or when preparing a pending event.
+ */
+ thd->binlog_flush_pending_rows_event(TRUE);
+ mysql_unlock_tables(thd, thd->lock);
+ thd->lock=0;
+ }
+}
+
+
/*
Close all tables used by the current substatement, or all tables
used by this thread if we are on the upper level.
@@ -1325,21 +1352,8 @@
/* Fallthrough */
}
- if (thd->lock)
- {
- /*
- For RBR we flush the pending event just before we unlock all the
- tables. This means that we are at the end of a topmost
- statement, so we ensure that the STMT_END_F flag is set on the
- pending event. For statements that are *inside* stored
- functions, the pending event will not be flushed: that will be
- handled either before writing a query log event (inside
- binlog_query()) or when preparing a pending event.
- */
- thd->binlog_flush_pending_rows_event(TRUE);
- mysql_unlock_tables(thd, thd->lock);
- thd->lock=0;
- }
+ unlock_thread_tables(thd);
+
/*
Note that we need to hold LOCK_open while changing the
open_tables list. Another thread may work on it.
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2009-11-30 21:37:27 +0000
+++ b/sql/sql_parse.cc 2009-12-03 21:07:48 +0000
@@ -1252,6 +1252,12 @@
ha_maria::implicit_commit(thd, FALSE);
#endif
+ /*
+ We should unlock tables before sending OK to client, because
+ unlocking makes results of insert (for example) visible for other
+ threads (for some engines like MyISAM).
+ */
+ unlock_thread_tables(thd);
net_end_statement(thd);
query_cache_end_of_result(thd);
/*
@@ -1645,6 +1651,12 @@
ha_maria::implicit_commit(thd, FALSE);
#endif
+ /*
+ We should unlock tables before sending OK to client, because unlocking
+ makes results of insert (for example) visible for other threads (for
+ some engines like MyISAM).
+ */
+ unlock_thread_tables(thd);
net_end_statement(thd);
query_cache_end_of_result(thd);
1
0

[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2776: Applied patch from to fix some problems with Croatian character set and LIKE queries
by noreply@launchpad.net 03 Dec '09
by noreply@launchpad.net 03 Dec '09
03 Dec '09
------------------------------------------------------------
revno: 2776
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Thu 2009-12-03 14:02:37 +0200
message:
Applied patch from to fix some problems with Croatian character set and LIKE queries
Author: Alexander Barkov
License: GPL
modified:
mysql-test/r/ctype_ucs.result
mysql-test/t/ctype_ucs.test
strings/ctype-ucs2.c
--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1
Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
1
0

[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2775: Merge
by noreply@launchpad.net 03 Dec '09
by noreply@launchpad.net 03 Dec '09
03 Dec '09
Merge authors:
Antony T Curtis (atcurtis)
hery.ramilison(a)sun.com
Igor Babaev (igorb-seattle)
Michael Widenius (monty)
Michael Widenius (monty)
Related merge proposals:
https://code.launchpad.net/~atcurtis/maria/maria-5.1-federatedx/+merge/14409
proposed by: Antony T Curtis (atcurtis)
review: Needs Fixing - Michael Widenius (monty)
------------------------------------------------------------
revno: 2775 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Thu 2009-12-03 13:34:11 +0200
message:
Merge
modified:
client/mysql.cc
client/mysqlcheck.c
client/mysqlslap.c
client/mysqltest.cc
mysql-test/lib/mtr_report.pm
mysql-test/mysql-test-run.pl
mysql-test/suite/federated/disabled.def
mysql-test/suite/federated/federated_server.result
mysql-test/suite/federated/federated_server.test
storage/federatedx/ha_federatedx.cc
unittest/mysys/Makefile.am
--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1
Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
1
0

[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2776)
by Michael Widenius 03 Dec '09
by Michael Widenius 03 Dec '09
03 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091203113411-cmr8g2lcp45n0prv
2776 Michael Widenius 2009-12-03
Applied patch from to fix some problems with Croatian character set and LIKE queries
Author: Alexander Barkov
License: GPL
modified:
mysql-test/r/ctype_ucs.result
mysql-test/t/ctype_ucs.test
strings/ctype-ucs2.c
per-file messages:
mysql-test/t/ctype_ucs.test
Added test case for Croatina character set
=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result 2008-12-23 14:21:01 +0000
+++ b/mysql-test/r/ctype_ucs.result 2009-12-03 12:02:37 +0000
@@ -1211,3 +1211,47 @@ HEX(DAYNAME(19700101))
0427043504420432043504400433
SET character_set_connection=latin1;
End of 5.0 tests
+Start of 5.1 tests
+SET NAMES utf8;
+CREATE TABLE t1 (
+a varchar(10) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
+key(a)
+);
+INSERT INTO t1 VALUES
+('aa'),('bb'),('cc'),('dd'),('ee'),('ff'),('gg'),('hh'),('ii'),
+('jj'),('kk'),('ll'),('mm'),('nn'),('oo'),('pp'),('rr'),('ss'),
+('tt'),('uu'),('vv'),('ww'),('xx'),('yy'),('zz');
+INSERT INTO t1 VALUES ('ca'),('cz'),('ch');
+INSERT INTO t1 VALUES ('da'),('dz'), (X'0064017E');
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'b%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 23 NULL 30 Using where; Using index
+SELECT * FROM t1 WHERE a LIKE 'c%';
+a
+ca
+cc
+cz
+ch
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'ch%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
+SELECT * FROM t1 WHERE a LIKE 'ch%';
+a
+ch
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci;
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'd%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
+SELECT hex(concat('d',_ucs2 0x017E,'%'));
+hex(concat('d',_ucs2 0x017E,'%'))
+0064017E0025
+EXPLAIN SELECT * FROM t1 WHERE a LIKE concat('d',_ucs2 0x017E,'%');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
+SELECT hex(a) FROM t1 WHERE a LIKE concat('D',_ucs2 0x017E,'%');
+hex(a)
+0064017E
+DROP TABLE t1;
=== modified file 'mysql-test/t/ctype_ucs.test'
--- a/mysql-test/t/ctype_ucs.test 2008-12-23 14:21:01 +0000
+++ b/mysql-test/t/ctype_ucs.test 2009-12-03 12:02:37 +0000
@@ -723,3 +723,34 @@ SELECT HEX(DAYNAME(19700101));
SET character_set_connection=latin1;
--echo End of 5.0 tests
+
+
+--echo Start of 5.1 tests
+#
+# Checking my_like_range_ucs2
+#
+SET NAMES utf8;
+CREATE TABLE t1 (
+ a varchar(10) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
+ key(a)
+);
+INSERT INTO t1 VALUES
+('aa'),('bb'),('cc'),('dd'),('ee'),('ff'),('gg'),('hh'),('ii'),
+('jj'),('kk'),('ll'),('mm'),('nn'),('oo'),('pp'),('rr'),('ss'),
+('tt'),('uu'),('vv'),('ww'),('xx'),('yy'),('zz');
+INSERT INTO t1 VALUES ('ca'),('cz'),('ch');
+INSERT INTO t1 VALUES ('da'),('dz'), (X'0064017E');
+# This one should scan only one row
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'b%';
+# This one should scan many rows: 'c' is a contraction head
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%';
+SELECT * FROM t1 WHERE a LIKE 'c%';
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'ch%';
+SELECT * FROM t1 WHERE a LIKE 'ch%';
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci;
+EXPLAIN SELECT * FROM t1 WHERE a LIKE 'd%';
+SELECT hex(concat('d',_ucs2 0x017E,'%'));
+EXPLAIN SELECT * FROM t1 WHERE a LIKE concat('d',_ucs2 0x017E,'%');
+SELECT hex(a) FROM t1 WHERE a LIKE concat('D',_ucs2 0x017E,'%');
+
+DROP TABLE t1;
=== modified file 'strings/ctype-ucs2.c'
--- a/strings/ctype-ucs2.c 2009-11-30 12:42:24 +0000
+++ b/strings/ctype-ucs2.c 2009-12-03 12:02:37 +0000
@@ -1498,6 +1498,14 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO
}
}
+
+static inline my_wc_t
+ucs2_to_wc(const uchar *ptr)
+{
+ return (((uint) ptr[0]) << 8) + ptr[1];
+}
+
+
/*
** Calculate min_str and max_str that ranges a LIKE string.
** Arguments:
@@ -1531,6 +1539,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO
for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0
; ptr+=2, charlen--)
{
+ my_wc_t wc;
if (ptr[0] == '\0' && ptr[1] == escape && ptr + 1 < end)
{
ptr+=2; /* Skip escape */
@@ -1567,9 +1576,9 @@ fill_max_and_min:
}
if (have_contractions && ptr + 3 < end &&
- ptr[0] == '\0' &&
- my_uca_can_be_contraction_head(cs, (uchar) ptr[1]))
+ my_uca_can_be_contraction_head(cs, (wc= ucs2_to_wc((uchar*) ptr))))
{
+ my_wc_t wc2;
/* Contraction head found */
if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many))
{
@@ -1581,9 +1590,8 @@ fill_max_and_min:
Check if the second letter can be contraction part,
and if two letters really produce a contraction.
*/
- if (ptr[2] == '\0' &&
- my_uca_can_be_contraction_tail(cs, (uchar) ptr[3]) &&
- my_uca_contraction2_weight(cs,(uchar) ptr[1], (uchar) ptr[3]))
+ if (my_uca_can_be_contraction_tail(cs, (wc2= ucs2_to_wc((uchar*) ptr + 2))) &&
+ my_uca_contraction2_weight(cs, wc , wc2))
{
/* Contraction found */
if (charlen == 1 || min_str + 2 >= min_end)
1
0
Seems we had 3 pages in the wiki for 5.1 release todo with mostly overlapping
content.
I merged these two:
http://askmonty.org/wiki/index.php?title=MariaDB_5.1_TODO
http://askmonty.org/wiki/index.php/MariaDB_Fix_Failures
into this one:
http://askmonty.org/wiki/index.php/MariaDB51_release_plan
and added redirects to the former two instead. I also updated some of the
information that was outdated.
- Kristian.
1
0

[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2775)
by Michael Widenius 03 Dec '09
by Michael Widenius 03 Dec '09
03 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091201160902-a3iq6lw82xbto9yp
2775 Michael Widenius 2009-12-03 [merge]
Merge
modified:
client/mysql.cc
client/mysqlcheck.c
client/mysqlslap.c
client/mysqltest.cc
mysql-test/lib/mtr_report.pm
mysql-test/mysql-test-run.pl
mysql-test/suite/federated/disabled.def
mysql-test/suite/federated/federated_server.result
mysql-test/suite/federated/federated_server.test
storage/federatedx/ha_federatedx.cc
unittest/mysys/Makefile.am
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2009-11-30 21:37:27 +0000
+++ b/client/mysql.cc 2009-12-03 11:34:11 +0000
@@ -1280,7 +1280,6 @@ sig_handler handle_sigint(int sig)
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
- /* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || (interrupted_query == 2))
{
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
@@ -1295,6 +1294,7 @@ sig_handler handle_sigint(int sig)
goto err;
}
+ /* First time try to kill the query, second time the connection */
interrupted_query++;
/* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
@@ -1305,10 +1305,13 @@ sig_handler handle_sigint(int sig)
sprintf(kill_buffer, "KILL %s%lu",
(interrupted_query == 1) ? "QUERY " : "",
mysql_thread_id(&mysql));
- tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
+ if (verbose)
+ tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n",
+ kill_buffer);
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
- tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
+ tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n");
+ interrupted_query= 0;
return;
@@ -1321,7 +1324,6 @@ err:
handler called mysql_end().
*/
mysql_thread_end();
- return;
#else
mysql_end(sig);
#endif
@@ -2881,13 +2883,8 @@ com_help(String *buffer __attribute__((u
return com_server_help(buffer,line,help_arg);
}
- put_info("\nFor information about MySQL products and services, visit:\n"
- " http://www.mysql.com/\n"
- "For developer information, including the MySQL Reference Manual, "
- "visit:\n"
- " http://dev.mysql.com/\n"
- "To buy MySQL Enterprise support, training, or other products, visit:\n"
- " https://shop.mysql.com/\n", INFO_INFO);
+ put_info("\nGeneral information about MariaDB can be found at\n"
+ "http://askmonty.org/wiki/index.php/Manual:Contents\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c 2009-09-28 06:24:19 +0000
+++ b/client/mysqlcheck.c 2009-12-03 11:19:05 +0000
@@ -857,7 +857,8 @@ int main(int argc, char **argv)
if (!opt_write_binlog)
{
- if (disable_binlog()) {
+ if (disable_binlog())
+ {
first_error= 1;
goto end;
}
=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c 2009-11-30 21:37:27 +0000
+++ b/client/mysqlslap.c 2009-12-03 11:34:11 +0000
@@ -472,11 +472,10 @@ void concurrency_loop(MYSQL *mysql, uint
if (commit_rate)
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
- if (pre_system)
- if ((sysret= system(pre_system)) != 0)
- fprintf(stderr,
- "Warning: Execution of pre_system option returned %d.\n",
- sysret);
+ if (pre_system && (sysret= system(pre_system)) != 0)
+ fprintf(stderr,
+ "Warning: Execution of pre_system option returned %d.\n",
+ sysret);
/*
Pre statements are always run after all other logic so they can
@@ -490,11 +489,10 @@ void concurrency_loop(MYSQL *mysql, uint
if (post_statements)
run_statements(mysql, post_statements);
- if (post_system)
- if ((sysret= system(post_system)) != 0)
- fprintf(stderr,
- "Warning: Execution of post_system option returned %d.\n",
- sysret);
+ if (post_system && (sysret= system(post_system)) != 0)
+ fprintf(stderr,
+ "Warning: Execution of post_system option returned %d.\n",
+ sysret);
/* We are finished with this run */
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
drop_primary_key_list();
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2009-11-16 20:49:51 +0000
+++ b/client/mysqltest.cc 2009-12-03 11:19:05 +0000
@@ -3497,9 +3497,10 @@ void do_diff_files(struct st_command *co
if ((error= compare_files(ds_filename.str, ds_filename2.str)) &&
match_expected_error(command, error, NULL) < 0)
{
- /* Compare of the two files failed, append them to output
- so the failure can be analyzed, but only if it was not
- expected to fail.
+ /*
+ Compare of the two files failed, append them to output
+ so the failure can be analyzed, but only if it was not
+ expected to fail.
*/
show_diff(&ds_res, ds_filename.str, ds_filename2.str);
log_file.write(&ds_res);
@@ -5013,7 +5014,8 @@ void do_connect(struct st_command *comma
con_options= ds_options.str;
while (*con_options)
{
- char* end;
+ size_t length;
+ char *end;
/* Step past any spaces in beginning of option*/
while (*con_options && my_isspace(charset_info, *con_options))
con_options++;
@@ -5021,13 +5023,14 @@ void do_connect(struct st_command *comma
end= con_options;
while (*end && !my_isspace(charset_info, *end))
end++;
- if (!strncmp(con_options, "SSL", 3))
+ length= (size_t) (end - con_options);
+ if (length == 3 && !strncmp(con_options, "SSL", 3))
con_ssl= 1;
- else if (!strncmp(con_options, "COMPRESS", 8))
+ else if (length == 8 && !strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
- else if (!strncmp(con_options, "PIPE", 4))
+ else if (length == 4 && !strncmp(con_options, "PIPE", 4))
con_pipe= 1;
- else if (!strncmp(con_options, "SHM", 3))
+ else if (length == 3 && !strncmp(con_options, "SHM", 3))
con_shm= 1;
else
die("Illegal option to connect: %.*s",
@@ -5096,14 +5099,13 @@ void do_connect(struct st_command *comma
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
}
- else if(shared_memory_base_name)
+ else if (shared_memory_base_name)
{
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
- shared_memory_base_name);
+ shared_memory_base_name);
}
#endif
-
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
@@ -6879,10 +6881,8 @@ void run_query_stmt(MYSQL *mysql, struct
MYSQL_STMT *stmt;
DYNAMIC_STRING ds_prepare_warnings;
DYNAMIC_STRING ds_execute_warnings;
- ulonglong affected_rows;
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
- LINT_INIT(affected_rows);
/*
Init a new stmt if it's not already one created for this connection
@@ -6981,6 +6981,9 @@ void run_query_stmt(MYSQL *mysql, struct
handle_no_error(command);
if (!disable_result_log)
{
+ ulonglong affected_rows;
+ LINT_INIT(affected_rows);
+
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
@@ -7026,39 +7029,33 @@ void run_query_stmt(MYSQL *mysql, struct
Need to grab affected rows information before getting
warnings here
*/
- {
- ulonglong affected_rows;
- LINT_INIT(affected_rows);
+ if (!disable_info)
+ affected_rows= mysql_affected_rows(mysql);
- if (!disable_info)
- affected_rows= mysql_affected_rows(mysql);
+ if (!disable_warnings)
+ {
+ /* Get the warnings from execute */
- if (!disable_warnings)
+ /* Append warnings to ds - if there are any */
+ if (append_warnings(&ds_execute_warnings, mysql) ||
+ ds_execute_warnings.length ||
+ ds_prepare_warnings.length ||
+ ds_warnings->length)
{
- /* Get the warnings from execute */
-
- /* Append warnings to ds - if there are any */
- if (append_warnings(&ds_execute_warnings, mysql) ||
- ds_execute_warnings.length ||
- ds_prepare_warnings.length ||
- ds_warnings->length)
- {
- dynstr_append_mem(ds, "Warnings:\n", 10);
- if (ds_warnings->length)
- dynstr_append_mem(ds, ds_warnings->str,
- ds_warnings->length);
- if (ds_prepare_warnings.length)
- dynstr_append_mem(ds, ds_prepare_warnings.str,
- ds_prepare_warnings.length);
- if (ds_execute_warnings.length)
- dynstr_append_mem(ds, ds_execute_warnings.str,
- ds_execute_warnings.length);
- }
+ dynstr_append_mem(ds, "Warnings:\n", 10);
+ if (ds_warnings->length)
+ dynstr_append_mem(ds, ds_warnings->str,
+ ds_warnings->length);
+ if (ds_prepare_warnings.length)
+ dynstr_append_mem(ds, ds_prepare_warnings.str,
+ ds_prepare_warnings.length);
+ if (ds_execute_warnings.length)
+ dynstr_append_mem(ds, ds_execute_warnings.str,
+ ds_execute_warnings.length);
}
-
- if (!disable_info)
- append_info(ds, affected_rows, mysql_info(mysql));
}
+ if (!disable_info)
+ append_info(ds, affected_rows, mysql_info(mysql));
}
end:
@@ -7235,7 +7232,6 @@ void run_query(struct st_connection *cn,
}
dynstr_free(&query_str);
-
}
if (sp_protocol_enabled &&
@@ -7662,6 +7658,7 @@ int main(int argc, char **argv)
my_bool q_send_flag= 0, abort_flag= 0;
uint command_executed= 0, last_command_executed= 0;
char save_file[FN_REFLEN];
+ bool empty_result= FALSE;
MY_INIT(argv[0]);
save_file[0]= 0;
@@ -7819,6 +7816,7 @@ int main(int argc, char **argv)
verbose_msg("Start processing test commands from '%s' ...", cur_file->file_name);
while (!read_command(&command) && !abort_flag)
{
+ my_bool ok_to_do;
int current_line_inc = 1, processed = 0;
if (command->type == Q_UNKNOWN || command->type == Q_COMMENT_WITH_COMMAND)
get_command_type(command);
@@ -7831,7 +7829,7 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
- my_bool ok_to_do= cur_block->ok;
+ ok_to_do= cur_block->ok;
/*
Some commands need to be "done" the first time if they may get
re-iterated over in a true context. This can only happen if there's
@@ -8167,8 +8165,6 @@ int main(int argc, char **argv)
if (parsing_disabled)
die("Test ended with parsing disabled");
- my_bool empty_result= FALSE;
-
/*
The whole test has been executed _sucessfully_.
Time to compare result or save it to record file.
=== modified file 'mysql-test/lib/mtr_report.pm'
--- a/mysql-test/lib/mtr_report.pm 2009-11-16 20:49:51 +0000
+++ b/mysql-test/lib/mtr_report.pm 2009-12-03 11:19:05 +0000
@@ -388,7 +388,7 @@ MSG
}
elsif (@$extra_warnings)
{
- mtr_error("There were errors/warnings in server logs after running test cases.");
+ mtr_error("There where errors/warnings in server logs after running test cases.");
}
elsif ($fail)
{
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-30 21:37:27 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-12-03 11:34:11 +0000
@@ -201,10 +201,10 @@ my $opt_mark_progress;
my $opt_sleep;
-my $opt_testcase_timeout= 15; # minutes
-my $opt_suite_timeout = 300; # minutes
-my $opt_shutdown_timeout= 10; # seconds
-my $opt_start_timeout = 180; # seconds
+my $opt_testcase_timeout= 15; # 15 minutes
+my $opt_suite_timeout = 360; # 6 hours
+my $opt_shutdown_timeout= 10; # 10 seconds
+my $opt_start_timeout = 180; # 180 seconds
sub testcase_timeout { return $opt_testcase_timeout * 60; };
sub suite_timeout { return $opt_suite_timeout * 60; };
@@ -1319,6 +1319,8 @@ sub command_line_setup {
{
# Indicate that we are using debugger
$glob_debugger= 1;
+ $opt_testcase_timeout= 60*60*24; # Don't abort debugging with timeout
+ $opt_suite_timeout= $opt_testcase_timeout;
$opt_retry= 1;
$opt_retry_failure= 1;
@@ -2151,7 +2153,6 @@ sub environment_setup {
# Create an environment variable to make it possible
# to detect that valgrind is being used from test cases
$ENV{'VALGRIND_TEST'}= $opt_valgrind;
-
}
@@ -2908,8 +2909,8 @@ sub mysql_install_db {
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
my $path_sql= my_find_file($install_basedir,
- ["mysql", "sql/share", "share/mysql",
- "share/mariadb", "share", "scripts"],
+ ["mysql", "sql/share", "share/mariadb",
+ "share/mysql", "share", "scripts"],
"mysql_system_tables.sql",
NOT_REQUIRED);
@@ -3861,7 +3862,7 @@ sub extract_server_log ($$) {
my ($error_log, $tname) = @_;
# Open the servers .err log file and read all lines
- # belonging to current tets into @lines
+ # belonging to current test into @lines
my $Ferr = IO::File->new($error_log)
or mtr_error("Could not open file '$error_log' for reading: $!");
=== modified file 'mysql-test/suite/federated/disabled.def'
--- a/mysql-test/suite/federated/disabled.def 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/disabled.def 2009-11-14 19:33:59 +0000
@@ -9,5 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-federated_server : needs fixup
=== modified file 'mysql-test/suite/federated/federated_server.result'
--- a/mysql-test/suite/federated/federated_server.result 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/federated_server.result 2009-11-14 19:33:59 +0000
@@ -175,6 +175,8 @@ CREATE TABLE db_bogus.t1 (
)
;
INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
+create user test_fed@localhost identified by 'foo';
+grant all on db_legitimate.* to test_fed@localhost;
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
@@ -211,15 +213,14 @@ id name
alter server s1 options (database 'db_bogus');
flush tables;
select * from federated.t1;
-id name
-2 this is bogus
+ERROR HY000: There was a problem processing the query on the foreign data source. Data source error: : 1044 : Access denied for user 'test_fed'@'localhost' to databa
drop server if exists 's1';
ERROR 42000: Access denied; you need the SUPER privilege for this operation
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@@ -228,8 +229,8 @@ drop server 's1';
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@@ -237,6 +238,7 @@ flush tables;
select * from federated.t1;
id name
1 this is legitimate
+drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;
drop user guest_super@localhost;
@@ -275,6 +277,6 @@ call p1();
drop procedure p1;
drop server if exists s;
DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;
=== modified file 'mysql-test/suite/federated/federated_server.test'
--- a/mysql-test/suite/federated/federated_server.test 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/federated_server.test 2009-11-14 19:33:59 +0000
@@ -239,6 +239,7 @@ alter server s1 options (database 'db_bo
connection master;
flush tables;
+--error ER_QUERY_ON_FOREIGN_DATA_SOURCE
select * from federated.t1;
connection conn_select;
@@ -249,8 +250,8 @@ drop server if exists 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
- USER 'root',
- PASSWORD '',
+ USER 'test_fed',
+ PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@@ -261,8 +262,8 @@ drop server 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
- USER 'root',
- PASSWORD '',
+ USER 'test_fed',
+ PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@@ -273,6 +274,7 @@ select * from federated.t1;
# clean up test
connection slave;
+drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;
=== modified file 'storage/federatedx/ha_federatedx.cc'
--- a/storage/federatedx/ha_federatedx.cc 2009-11-30 21:37:27 +0000
+++ b/storage/federatedx/ha_federatedx.cc 2009-12-03 11:34:11 +0000
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2008, Patrick Galbraith
+Copyright (c) 2008-2009, Patrick Galbraith & Antony Curtis
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -308,7 +308,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/
-#define MYSQL_SERVER 1q
+#define MYSQL_SERVER 1
#include "mysql_priv.h"
#include <mysql/plugin.h>
@@ -1627,7 +1627,13 @@ static int free_server(federatedx_txn *t
{
MEM_ROOT mem_root;
- txn->close(server);
+ if (!txn)
+ {
+ federatedx_txn tmp_txn;
+ tmp_txn.close(server);
+ }
+ else
+ txn->close(server);
DBUG_ASSERT(server->io_count == 0);
@@ -1785,21 +1791,25 @@ int ha_federatedx::close(void)
if (stored_result)
retval= free_result();
- /* Disconnect from mysql. thd may be null during refresh */
- txn= thd ? get_txn(thd, true) : new federatedx_txn();
+ /* Disconnect from mysql */
+ if (!thd || !(txn= get_txn(thd, true)))
+ {
+ federatedx_txn tmp_txn;
+
+ tmp_txn.release(&io);
- if (txn)
+ DBUG_ASSERT(io == NULL);
+
+ if ((error= free_share(&tmp_txn, share)))
+ retval= error;
+ }
+ else
{
txn->release(&io);
-
DBUG_ASSERT(io == NULL);
if ((error= free_share(txn, share)))
retval= error;
-
- if (!thd)
- delete txn;
-
}
DBUG_RETURN(retval);
}
@@ -2793,14 +2803,16 @@ int ha_federatedx::rnd_end()
int ha_federatedx::free_result()
{
int error;
+ federatedx_io *tmp_io= 0, **iop;
DBUG_ASSERT(stored_result);
- if ((error= txn->acquire(share, FALSE, &io)))
+ if (!*(iop= &io) && (error= txn->acquire(share, TRUE, (iop= &tmp_io))))
{
DBUG_ASSERT(0); // Fail when testing
return error;
}
- io->free_result(stored_result);
+ (*iop)->free_result(stored_result);
stored_result= 0;
+ txn->release(&tmp_io);
return 0;
}
@@ -2985,7 +2997,7 @@ int ha_federatedx::info(uint flag)
{
char error_buffer[FEDERATEDX_QUERY_BUFFER_SIZE];
uint error_code;
- federatedx_io *tmp_io= 0;
+ federatedx_io *tmp_io= 0, **iop= 0;
DBUG_ENTER("ha_federatedx::info");
error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
@@ -2993,7 +3005,7 @@ int ha_federatedx::info(uint flag)
/* we want not to show table status if not needed to do so */
if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO))
{
- if ((error_code= txn->acquire(share, TRUE, &tmp_io)))
+ if (!*(iop= &io) && (error_code= txn->acquire(share, TRUE, (iop= &tmp_io))))
goto fail;
}
@@ -3006,13 +3018,13 @@ int ha_federatedx::info(uint flag)
if (flag & HA_STATUS_CONST)
stats.block_size= 4096;
- if (tmp_io->table_metadata(&stats, share->table_name,
+ if ((*iop)->table_metadata(&stats, share->table_name,
share->table_name_length, flag))
goto error;
}
if (flag & HA_STATUS_AUTO)
- stats.auto_increment_value= tmp_io->last_insert_id();
+ stats.auto_increment_value= (*iop)->last_insert_id();
/*
If ::info created it's own transaction, close it. This happens in case
@@ -3023,10 +3035,10 @@ int ha_federatedx::info(uint flag)
DBUG_RETURN(0);
error:
- if (tmp_io)
+ if (iop && *iop)
{
my_sprintf(error_buffer, (error_buffer, ": %d : %s",
- tmp_io->error_code(), tmp_io->error_str()));
+ (*iop)->error_code(), (*iop)->error_str()));
my_error(error_code, MYF(0), error_buffer);
}
else
=== modified file 'unittest/mysys/Makefile.am'
--- a/unittest/mysys/Makefile.am 2009-11-26 08:44:38 +0000
+++ b/unittest/mysys/Makefile.am 2009-12-03 11:19:05 +0000
@@ -24,7 +24,7 @@ LDADD = $(top_builddir)/unittest/mytap
$(top_builddir)/strings/libmystrings.a
EXTRA_DIST = CMakeLists.txt
-noinst_PROGRAMS = bitmap-t base64-t lf-t waiting_threads-t
+noinst_PROGRAMS = bitmap-t base64-t my_atomic-t lf-t waiting_threads-t
if NEED_THREAD
# my_atomic-t is used to check thread functions, so it is safe to
1
0

[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2778)
by Michael Widenius 03 Dec '09
by Michael Widenius 03 Dec '09
03 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091130124224-45xbn8nkmgnu1c2f
2778 Michael Widenius 2009-12-03 [merge]
Merge with maria-5.1-federatedx; A patch to fix bugs in federatedx and enable federated_server.test
Author: Antony Curtis
License: BSD
modified:
client/mysql.cc
client/mysqlcheck.c
client/mysqlslap.c
client/mysqltest.cc
configure.in
mysql-test/lib/mtr_report.pm
mysql-test/mysql-test-run.pl
mysql-test/suite/federated/disabled.def
mysql-test/suite/federated/federated_server.result
mysql-test/suite/federated/federated_server.test
storage/federatedx/ha_federatedx.cc
unittest/mysys/Makefile.am
per-file messages:
client/mysql.cc
Reset variable if CTRL-C was used to kill running query, so that the user can do it again
client/mysqlcheck.c
Indentation fix
client/mysqlslap.c
Indentation fixes
client/mysqltest.cc
Make testing of commands safer by also testing length
Removed not used variable
Fixed indentation to be as it was before last patch
mysql-test/lib/mtr_report.pm
Fixed typo
mysql-test/mysql-test-run.pl
Merge (Align code with default mysql-tes-run.pl)
mysql-test/suite/federated/disabled.def
Removed test case
storage/federatedx/ha_federatedx.cc
Removed my changes and applied Antony's instead
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2009-11-16 20:49:51 +0000
+++ b/client/mysql.cc 2009-12-03 11:19:05 +0000
@@ -1281,7 +1281,6 @@ sig_handler handle_sigint(int sig)
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
- /* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || (interrupted_query == 2))
{
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
@@ -1296,6 +1295,7 @@ sig_handler handle_sigint(int sig)
goto err;
}
+ /* First time try to kill the query, second time the connection */
interrupted_query++;
/* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
@@ -1306,10 +1306,13 @@ sig_handler handle_sigint(int sig)
sprintf(kill_buffer, "KILL %s%lu",
(interrupted_query == 1) ? "QUERY " : "",
mysql_thread_id(&mysql));
- tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
+ if (verbose)
+ tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n",
+ kill_buffer);
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
- tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
+ tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n");
+ interrupted_query= 0;
return;
@@ -1322,7 +1325,6 @@ err:
handler called mysql_end().
*/
mysql_thread_end();
- return;
#else
mysql_end(sig);
#endif
@@ -2882,13 +2884,8 @@ com_help(String *buffer __attribute__((u
return com_server_help(buffer,line,help_arg);
}
- put_info("\nFor information about MySQL products and services, visit:\n"
- " http://www.mysql.com/\n"
- "For developer information, including the MySQL Reference Manual, "
- "visit:\n"
- " http://dev.mysql.com/\n"
- "To buy MySQL Enterprise support, training, or other products, visit:\n"
- " https://shop.mysql.com/\n", INFO_INFO);
+ put_info("\nGeneral information about MariaDB can be found at\n"
+ "http://askmonty.org/wiki/index.php/Manual:Contents\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c 2009-09-28 06:24:19 +0000
+++ b/client/mysqlcheck.c 2009-12-03 11:19:05 +0000
@@ -857,7 +857,8 @@ int main(int argc, char **argv)
if (!opt_write_binlog)
{
- if (disable_binlog()) {
+ if (disable_binlog())
+ {
first_error= 1;
goto end;
}
=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c 2009-11-16 20:49:51 +0000
+++ b/client/mysqlslap.c 2009-12-03 11:19:05 +0000
@@ -472,11 +472,10 @@ void concurrency_loop(MYSQL *mysql, uint
if (commit_rate)
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
- if (pre_system)
- if ((sysret= system(pre_system)) != 0)
- fprintf(stderr,
- "Warning: Execution of pre_system option returned %d.\n",
- sysret);
+ if (pre_system && (sysret= system(pre_system)) != 0)
+ fprintf(stderr,
+ "Warning: Execution of pre_system option returned %d.\n",
+ sysret);
/*
Pre statements are always run after all other logic so they can
@@ -490,11 +489,10 @@ void concurrency_loop(MYSQL *mysql, uint
if (post_statements)
run_statements(mysql, post_statements);
- if (post_system)
- if ((sysret= system(post_system)) != 0)
- fprintf(stderr,
- "Warning: Execution of post_system option returned %d.\n",
- sysret);
+ if (post_system && (sysret= system(post_system)) != 0)
+ fprintf(stderr,
+ "Warning: Execution of post_system option returned %d.\n",
+ sysret);
/* We are finished with this run */
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
drop_primary_key_list();
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2009-11-16 20:49:51 +0000
+++ b/client/mysqltest.cc 2009-12-03 11:19:05 +0000
@@ -3497,9 +3497,10 @@ void do_diff_files(struct st_command *co
if ((error= compare_files(ds_filename.str, ds_filename2.str)) &&
match_expected_error(command, error, NULL) < 0)
{
- /* Compare of the two files failed, append them to output
- so the failure can be analyzed, but only if it was not
- expected to fail.
+ /*
+ Compare of the two files failed, append them to output
+ so the failure can be analyzed, but only if it was not
+ expected to fail.
*/
show_diff(&ds_res, ds_filename.str, ds_filename2.str);
log_file.write(&ds_res);
@@ -5013,7 +5014,8 @@ void do_connect(struct st_command *comma
con_options= ds_options.str;
while (*con_options)
{
- char* end;
+ size_t length;
+ char *end;
/* Step past any spaces in beginning of option*/
while (*con_options && my_isspace(charset_info, *con_options))
con_options++;
@@ -5021,13 +5023,14 @@ void do_connect(struct st_command *comma
end= con_options;
while (*end && !my_isspace(charset_info, *end))
end++;
- if (!strncmp(con_options, "SSL", 3))
+ length= (size_t) (end - con_options);
+ if (length == 3 && !strncmp(con_options, "SSL", 3))
con_ssl= 1;
- else if (!strncmp(con_options, "COMPRESS", 8))
+ else if (length == 8 && !strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
- else if (!strncmp(con_options, "PIPE", 4))
+ else if (length == 4 && !strncmp(con_options, "PIPE", 4))
con_pipe= 1;
- else if (!strncmp(con_options, "SHM", 3))
+ else if (length == 3 && !strncmp(con_options, "SHM", 3))
con_shm= 1;
else
die("Illegal option to connect: %.*s",
@@ -5096,14 +5099,13 @@ void do_connect(struct st_command *comma
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
}
- else if(shared_memory_base_name)
+ else if (shared_memory_base_name)
{
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
- shared_memory_base_name);
+ shared_memory_base_name);
}
#endif
-
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
@@ -6879,10 +6881,8 @@ void run_query_stmt(MYSQL *mysql, struct
MYSQL_STMT *stmt;
DYNAMIC_STRING ds_prepare_warnings;
DYNAMIC_STRING ds_execute_warnings;
- ulonglong affected_rows;
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
- LINT_INIT(affected_rows);
/*
Init a new stmt if it's not already one created for this connection
@@ -6981,6 +6981,9 @@ void run_query_stmt(MYSQL *mysql, struct
handle_no_error(command);
if (!disable_result_log)
{
+ ulonglong affected_rows;
+ LINT_INIT(affected_rows);
+
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
@@ -7026,39 +7029,33 @@ void run_query_stmt(MYSQL *mysql, struct
Need to grab affected rows information before getting
warnings here
*/
- {
- ulonglong affected_rows;
- LINT_INIT(affected_rows);
+ if (!disable_info)
+ affected_rows= mysql_affected_rows(mysql);
- if (!disable_info)
- affected_rows= mysql_affected_rows(mysql);
+ if (!disable_warnings)
+ {
+ /* Get the warnings from execute */
- if (!disable_warnings)
+ /* Append warnings to ds - if there are any */
+ if (append_warnings(&ds_execute_warnings, mysql) ||
+ ds_execute_warnings.length ||
+ ds_prepare_warnings.length ||
+ ds_warnings->length)
{
- /* Get the warnings from execute */
-
- /* Append warnings to ds - if there are any */
- if (append_warnings(&ds_execute_warnings, mysql) ||
- ds_execute_warnings.length ||
- ds_prepare_warnings.length ||
- ds_warnings->length)
- {
- dynstr_append_mem(ds, "Warnings:\n", 10);
- if (ds_warnings->length)
- dynstr_append_mem(ds, ds_warnings->str,
- ds_warnings->length);
- if (ds_prepare_warnings.length)
- dynstr_append_mem(ds, ds_prepare_warnings.str,
- ds_prepare_warnings.length);
- if (ds_execute_warnings.length)
- dynstr_append_mem(ds, ds_execute_warnings.str,
- ds_execute_warnings.length);
- }
+ dynstr_append_mem(ds, "Warnings:\n", 10);
+ if (ds_warnings->length)
+ dynstr_append_mem(ds, ds_warnings->str,
+ ds_warnings->length);
+ if (ds_prepare_warnings.length)
+ dynstr_append_mem(ds, ds_prepare_warnings.str,
+ ds_prepare_warnings.length);
+ if (ds_execute_warnings.length)
+ dynstr_append_mem(ds, ds_execute_warnings.str,
+ ds_execute_warnings.length);
}
-
- if (!disable_info)
- append_info(ds, affected_rows, mysql_info(mysql));
}
+ if (!disable_info)
+ append_info(ds, affected_rows, mysql_info(mysql));
}
end:
@@ -7235,7 +7232,6 @@ void run_query(struct st_connection *cn,
}
dynstr_free(&query_str);
-
}
if (sp_protocol_enabled &&
@@ -7662,6 +7658,7 @@ int main(int argc, char **argv)
my_bool q_send_flag= 0, abort_flag= 0;
uint command_executed= 0, last_command_executed= 0;
char save_file[FN_REFLEN];
+ bool empty_result= FALSE;
MY_INIT(argv[0]);
save_file[0]= 0;
@@ -7819,6 +7816,7 @@ int main(int argc, char **argv)
verbose_msg("Start processing test commands from '%s' ...", cur_file->file_name);
while (!read_command(&command) && !abort_flag)
{
+ my_bool ok_to_do;
int current_line_inc = 1, processed = 0;
if (command->type == Q_UNKNOWN || command->type == Q_COMMENT_WITH_COMMAND)
get_command_type(command);
@@ -7831,7 +7829,7 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
- my_bool ok_to_do= cur_block->ok;
+ ok_to_do= cur_block->ok;
/*
Some commands need to be "done" the first time if they may get
re-iterated over in a true context. This can only happen if there's
@@ -8167,8 +8165,6 @@ int main(int argc, char **argv)
if (parsing_disabled)
die("Test ended with parsing disabled");
- my_bool empty_result= FALSE;
-
/*
The whole test has been executed _sucessfully_.
Time to compare result or save it to record file.
=== modified file 'configure.in'
--- a/configure.in 2009-11-16 20:49:51 +0000
+++ b/configure.in 2009-12-03 11:19:05 +0000
@@ -15,7 +15,7 @@ AC_CANONICAL_SYSTEM
# MySQL version number.
#
# Note: the following line must be parseable by win/configure.js:GetVersion()
-AM_INIT_AUTOMAKE(mysql, 5.1.41-mariadb-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.41-MariaDB-beta)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'mysql-test/lib/mtr_report.pm'
--- a/mysql-test/lib/mtr_report.pm 2009-11-16 20:49:51 +0000
+++ b/mysql-test/lib/mtr_report.pm 2009-12-03 11:19:05 +0000
@@ -388,7 +388,7 @@ MSG
}
elsif (@$extra_warnings)
{
- mtr_error("There were errors/warnings in server logs after running test cases.");
+ mtr_error("There where errors/warnings in server logs after running test cases.");
}
elsif ($fail)
{
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-27 13:20:59 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-12-03 11:19:05 +0000
@@ -201,10 +201,10 @@ my $opt_mark_progress;
my $opt_sleep;
-my $opt_testcase_timeout= 15; # minutes
-my $opt_suite_timeout = 300; # minutes
-my $opt_shutdown_timeout= 10; # seconds
-my $opt_start_timeout = 180; # seconds
+my $opt_testcase_timeout= 15; # 15 minutes
+my $opt_suite_timeout = 360; # 6 hours
+my $opt_shutdown_timeout= 10; # 10 seconds
+my $opt_start_timeout = 180; # 180 seconds
sub testcase_timeout { return $opt_testcase_timeout * 60; };
sub suite_timeout { return $opt_suite_timeout * 60; };
@@ -215,7 +215,7 @@ my $opt_start_dirty;
my $start_only;
my $opt_wait_all;
my $opt_repeat= 1;
-my $opt_retry= 3;
+my $opt_retry= 1;
my $opt_retry_failure= 2;
my $opt_strace_client;
@@ -612,8 +612,9 @@ sub run_test_server ($$$) {
my $fake_test= My::Test::read_test($sock);
my $test_list= join (" ", @{$fake_test->{testnames}});
push @$extra_warnings, $test_list;
+ my $report= $fake_test->{'warnings'};
mtr_report("***Warnings generated in error logs during shutdown ".
- "after running tests: $test_list");
+ "after running tests: $test_list\n\n$report");
$test_failure= 1;
if ( !$opt_force ) {
# Test failure due to warnings, force is off
@@ -1318,6 +1319,8 @@ sub command_line_setup {
{
# Indicate that we are using debugger
$glob_debugger= 1;
+ $opt_testcase_timeout= 60*60*24; # Don't abort debugging with timeout
+ $opt_suite_timeout= $opt_testcase_timeout;
$opt_retry= 1;
$opt_retry_failure= 1;
@@ -2150,7 +2153,6 @@ sub environment_setup {
# Create an environment variable to make it possible
# to detect that valgrind is being used from test cases
$ENV{'VALGRIND_TEST'}= $opt_valgrind;
-
}
@@ -2907,8 +2909,8 @@ sub mysql_install_db {
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
my $path_sql= my_find_file($install_basedir,
- ["mysql", "sql/share", "share/mysql",
- "share/mariadb", "share", "scripts"],
+ ["mysql", "sql/share", "share/mariadb",
+ "share/mysql", "share", "scripts"],
"mysql_system_tables.sql",
NOT_REQUIRED);
@@ -3860,7 +3862,7 @@ sub extract_server_log ($$) {
my ($error_log, $tname) = @_;
# Open the servers .err log file and read all lines
- # belonging to current tets into @lines
+ # belonging to current test into @lines
my $Ferr = IO::File->new($error_log)
or mtr_error("Could not open file '$error_log' for reading: $!");
@@ -3999,9 +4001,11 @@ sub extract_warning_lines ($) {
qr/Slave I\/O: Get master COLLATION_SERVER failed with error:.*/,
qr/Slave I\/O: Get master TIME_ZONE failed with error:.*/,
qr/Slave I\/O: error reconnecting to master '.*' - retry-time: [1-3] retries/,
+ qr/Error reading packet/,
+ qr/Slave: Can't drop database.* database doesn't exist/,
);
- my $match_count= 0;
+ my $matched_lines= [];
LINE: foreach my $line ( @lines )
{
PAT: foreach my $pat ( @patterns )
@@ -4013,18 +4017,18 @@ sub extract_warning_lines ($) {
next LINE if $line =~ $apat;
}
print $Fwarn $line;
- ++$match_count;
+ push @$matched_lines, $line;
last PAT;
}
}
}
$Fwarn = undef; # Close file
- if ($match_count > 0 &&
+ if (scalar(@$matched_lines) > 0 &&
defined($last_warning_position->{$error_log}{test_names})) {
- return $last_warning_position->{$error_log}{test_names};
+ return ($last_warning_position->{$error_log}{test_names}, $matched_lines);
} else {
- return [];
+ return ([], $matched_lines);
}
}
@@ -4201,14 +4205,18 @@ sub check_warnings ($) {
sub check_warnings_post_shutdown {
my ($server_socket)= @_;
my $testname_hash= { };
+ my $report= '';
foreach my $mysqld ( mysqlds())
{
- my $testlist= extract_warning_lines($mysqld->value('#log-error'));
+ my ($testlist, $match_lines)=
+ extract_warning_lines($mysqld->value('#log-error'));
$testname_hash->{$_}= 1 for @$testlist;
+ $report.= join('', @$match_lines);
}
my @warning_tests= keys(%$testname_hash);
if (@warning_tests) {
my $fake_test= My::Test->new(testnames => \@warning_tests);
+ $fake_test->{'warnings'}= $report;
$fake_test->write_test($server_socket, 'WARNINGS');
}
}
=== modified file 'mysql-test/suite/federated/disabled.def'
--- a/mysql-test/suite/federated/disabled.def 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/disabled.def 2009-11-14 19:33:59 +0000
@@ -9,5 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-federated_server : needs fixup
=== modified file 'mysql-test/suite/federated/federated_server.result'
--- a/mysql-test/suite/federated/federated_server.result 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/federated_server.result 2009-11-14 19:33:59 +0000
@@ -175,6 +175,8 @@ CREATE TABLE db_bogus.t1 (
)
;
INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
+create user test_fed@localhost identified by 'foo';
+grant all on db_legitimate.* to test_fed@localhost;
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
@@ -211,15 +213,14 @@ id name
alter server s1 options (database 'db_bogus');
flush tables;
select * from federated.t1;
-id name
-2 this is bogus
+ERROR HY000: There was a problem processing the query on the foreign data source. Data source error: : 1044 : Access denied for user 'test_fed'@'localhost' to databa
drop server if exists 's1';
ERROR 42000: Access denied; you need the SUPER privilege for this operation
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@@ -228,8 +229,8 @@ drop server 's1';
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@@ -237,6 +238,7 @@ flush tables;
select * from federated.t1;
id name
1 this is legitimate
+drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;
drop user guest_super@localhost;
@@ -275,6 +277,6 @@ call p1();
drop procedure p1;
drop server if exists s;
DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;
=== modified file 'mysql-test/suite/federated/federated_server.test'
--- a/mysql-test/suite/federated/federated_server.test 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/federated_server.test 2009-11-14 19:33:59 +0000
@@ -239,6 +239,7 @@ alter server s1 options (database 'db_bo
connection master;
flush tables;
+--error ER_QUERY_ON_FOREIGN_DATA_SOURCE
select * from federated.t1;
connection conn_select;
@@ -249,8 +250,8 @@ drop server if exists 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
- USER 'root',
- PASSWORD '',
+ USER 'test_fed',
+ PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@@ -261,8 +262,8 @@ drop server 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
- USER 'root',
- PASSWORD '',
+ USER 'test_fed',
+ PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@@ -273,6 +274,7 @@ select * from federated.t1;
# clean up test
connection slave;
+drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;
=== modified file 'storage/federatedx/ha_federatedx.cc'
--- a/storage/federatedx/ha_federatedx.cc 2009-11-16 20:49:51 +0000
+++ b/storage/federatedx/ha_federatedx.cc 2009-12-03 11:19:05 +0000
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2008, Patrick Galbraith
+Copyright (c) 2008-2009, Patrick Galbraith & Antony Curtis
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -308,7 +308,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/
-#define MYSQL_SERVER 1q
+#define MYSQL_SERVER 1
#include "mysql_priv.h"
#include <mysql/plugin.h>
@@ -1627,7 +1627,13 @@ static int free_server(federatedx_txn *t
{
MEM_ROOT mem_root;
- txn->close(server);
+ if (!txn)
+ {
+ federatedx_txn tmp_txn;
+ tmp_txn.close(server);
+ }
+ else
+ txn->close(server);
DBUG_ASSERT(server->io_count == 0);
@@ -1785,21 +1791,25 @@ int ha_federatedx::close(void)
if (stored_result)
retval= free_result();
- /* Disconnect from mysql. thd may be null during refresh */
- txn= thd ? get_txn(thd, true) : new federatedx_txn();
+ /* Disconnect from mysql */
+ if (!thd || !(txn= get_txn(thd, true)))
+ {
+ federatedx_txn tmp_txn;
+
+ tmp_txn.release(&io);
- if (txn)
+ DBUG_ASSERT(io == NULL);
+
+ if ((error= free_share(&tmp_txn, share)))
+ retval= error;
+ }
+ else
{
txn->release(&io);
-
DBUG_ASSERT(io == NULL);
if ((error= free_share(txn, share)))
retval= error;
-
- if (!thd)
- delete txn;
-
}
DBUG_RETURN(retval);
}
@@ -2793,14 +2803,16 @@ int ha_federatedx::rnd_end()
int ha_federatedx::free_result()
{
int error;
+ federatedx_io *tmp_io= 0, **iop;
DBUG_ASSERT(stored_result);
- if ((error= txn->acquire(share, FALSE, &io)))
+ if (!*(iop= &io) && (error= txn->acquire(share, TRUE, (iop= &tmp_io))))
{
DBUG_ASSERT(0); // Fail when testing
return error;
}
- io->free_result(stored_result);
+ (*iop)->free_result(stored_result);
stored_result= 0;
+ txn->release(&tmp_io);
return 0;
}
@@ -2985,7 +2997,7 @@ int ha_federatedx::info(uint flag)
{
char error_buffer[FEDERATEDX_QUERY_BUFFER_SIZE];
uint error_code;
- federatedx_io *tmp_io= 0;
+ federatedx_io *tmp_io= 0, **iop= 0;
DBUG_ENTER("ha_federatedx::info");
error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
@@ -2993,7 +3005,7 @@ int ha_federatedx::info(uint flag)
/* we want not to show table status if not needed to do so */
if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO))
{
- if ((error_code= txn->acquire(share, TRUE, &tmp_io)))
+ if (!*(iop= &io) && (error_code= txn->acquire(share, TRUE, (iop= &tmp_io))))
goto fail;
}
@@ -3006,13 +3018,13 @@ int ha_federatedx::info(uint flag)
if (flag & HA_STATUS_CONST)
stats.block_size= 4096;
- if (tmp_io->table_metadata(&stats, share->table_name,
+ if ((*iop)->table_metadata(&stats, share->table_name,
share->table_name_length, flag))
goto error;
}
if (flag & HA_STATUS_AUTO)
- stats.auto_increment_value= tmp_io->last_insert_id();
+ stats.auto_increment_value= (*iop)->last_insert_id();
/*
If ::info created it's own transaction, close it. This happens in case
@@ -3023,10 +3035,10 @@ int ha_federatedx::info(uint flag)
DBUG_RETURN(0);
error:
- if (tmp_io)
+ if (iop && *iop)
{
my_sprintf(error_buffer, (error_buffer, ": %d : %s",
- tmp_io->error_code(), tmp_io->error_str()));
+ (*iop)->error_code(), (*iop)->error_str()));
my_error(error_code, MYF(0), error_buffer);
}
else
=== modified file 'unittest/mysys/Makefile.am'
--- a/unittest/mysys/Makefile.am 2009-11-26 08:44:38 +0000
+++ b/unittest/mysys/Makefile.am 2009-12-03 11:19:05 +0000
@@ -24,7 +24,7 @@ LDADD = $(top_builddir)/unittest/mytap
$(top_builddir)/strings/libmystrings.a
EXTRA_DIST = CMakeLists.txt
-noinst_PROGRAMS = bitmap-t base64-t lf-t waiting_threads-t
+noinst_PROGRAMS = bitmap-t base64-t my_atomic-t lf-t waiting_threads-t
if NEED_THREAD
# my_atomic-t is used to check thread functions, so it is safe to
1
0

[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2778)
by Michael Widenius 03 Dec '09
by Michael Widenius 03 Dec '09
03 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091130124224-45xbn8nkmgnu1c2f
2778 Michael Widenius 2009-12-03 [merge]
Merge with maria-5.1-federatedx; Antony's patch for federatedx
modified:
client/mysql.cc
client/mysqlcheck.c
client/mysqlslap.c
client/mysqltest.cc
configure.in
mysql-test/lib/mtr_report.pm
mysql-test/mysql-test-run.pl
mysql-test/suite/federated/disabled.def
mysql-test/suite/federated/federated_server.result
mysql-test/suite/federated/federated_server.test
storage/federatedx/ha_federatedx.cc
unittest/mysys/Makefile.am
per-file messages:
client/mysql.cc
Reset variable if CTRL-C was used to kill running query, so that the user can do it again
client/mysqlcheck.c
Indentation fix
client/mysqlslap.c
Indentation fixes
client/mysqltest.cc
Make testing of commands safer by also testing length
Removed not used variable
Fixed indentation to be as it was before last patch
mysql-test/lib/mtr_report.pm
Fixed typo
mysql-test/mysql-test-run.pl
Merge (Align code with default mysql-tes-run.pl)
mysql-test/suite/federated/disabled.def
Removed test case
storage/federatedx/ha_federatedx.cc
Removed my changes and applied Antony's instead
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2009-11-16 20:49:51 +0000
+++ b/client/mysql.cc 2009-12-03 11:07:55 +0000
@@ -1281,7 +1281,6 @@ sig_handler handle_sigint(int sig)
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
- /* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || (interrupted_query == 2))
{
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
@@ -1296,6 +1295,7 @@ sig_handler handle_sigint(int sig)
goto err;
}
+ /* First time try to kill the query, second time the connection */
interrupted_query++;
/* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
@@ -1306,10 +1306,13 @@ sig_handler handle_sigint(int sig)
sprintf(kill_buffer, "KILL %s%lu",
(interrupted_query == 1) ? "QUERY " : "",
mysql_thread_id(&mysql));
- tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
+ if (verbose)
+ tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n",
+ kill_buffer);
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
- tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
+ tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n");
+ interrupted_query= 0;
return;
@@ -1322,7 +1325,6 @@ err:
handler called mysql_end().
*/
mysql_thread_end();
- return;
#else
mysql_end(sig);
#endif
@@ -2882,13 +2884,8 @@ com_help(String *buffer __attribute__((u
return com_server_help(buffer,line,help_arg);
}
- put_info("\nFor information about MySQL products and services, visit:\n"
- " http://www.mysql.com/\n"
- "For developer information, including the MySQL Reference Manual, "
- "visit:\n"
- " http://dev.mysql.com/\n"
- "To buy MySQL Enterprise support, training, or other products, visit:\n"
- " https://shop.mysql.com/\n", INFO_INFO);
+ put_info("\nGeneral information about MariaDB can be found at\n"
+ "http://askmonty.org/wiki/index.php/Manual:Contents\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c 2009-09-28 06:24:19 +0000
+++ b/client/mysqlcheck.c 2009-12-03 11:07:55 +0000
@@ -857,7 +857,8 @@ int main(int argc, char **argv)
if (!opt_write_binlog)
{
- if (disable_binlog()) {
+ if (disable_binlog())
+ {
first_error= 1;
goto end;
}
=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c 2009-11-16 20:49:51 +0000
+++ b/client/mysqlslap.c 2009-12-03 11:07:55 +0000
@@ -472,11 +472,10 @@ void concurrency_loop(MYSQL *mysql, uint
if (commit_rate)
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
- if (pre_system)
- if ((sysret= system(pre_system)) != 0)
- fprintf(stderr,
- "Warning: Execution of pre_system option returned %d.\n",
- sysret);
+ if (pre_system && (sysret= system(pre_system)) != 0)
+ fprintf(stderr,
+ "Warning: Execution of pre_system option returned %d.\n",
+ sysret);
/*
Pre statements are always run after all other logic so they can
@@ -490,11 +489,10 @@ void concurrency_loop(MYSQL *mysql, uint
if (post_statements)
run_statements(mysql, post_statements);
- if (post_system)
- if ((sysret= system(post_system)) != 0)
- fprintf(stderr,
- "Warning: Execution of post_system option returned %d.\n",
- sysret);
+ if (post_system && (sysret= system(post_system)) != 0)
+ fprintf(stderr,
+ "Warning: Execution of post_system option returned %d.\n",
+ sysret);
/* We are finished with this run */
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
drop_primary_key_list();
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2009-11-16 20:49:51 +0000
+++ b/client/mysqltest.cc 2009-12-03 11:07:55 +0000
@@ -3497,9 +3497,10 @@ void do_diff_files(struct st_command *co
if ((error= compare_files(ds_filename.str, ds_filename2.str)) &&
match_expected_error(command, error, NULL) < 0)
{
- /* Compare of the two files failed, append them to output
- so the failure can be analyzed, but only if it was not
- expected to fail.
+ /*
+ Compare of the two files failed, append them to output
+ so the failure can be analyzed, but only if it was not
+ expected to fail.
*/
show_diff(&ds_res, ds_filename.str, ds_filename2.str);
log_file.write(&ds_res);
@@ -5013,7 +5014,8 @@ void do_connect(struct st_command *comma
con_options= ds_options.str;
while (*con_options)
{
- char* end;
+ size_t length;
+ char *end;
/* Step past any spaces in beginning of option*/
while (*con_options && my_isspace(charset_info, *con_options))
con_options++;
@@ -5021,13 +5023,14 @@ void do_connect(struct st_command *comma
end= con_options;
while (*end && !my_isspace(charset_info, *end))
end++;
- if (!strncmp(con_options, "SSL", 3))
+ length= (size_t) (end - con_options);
+ if (length == 3 && !strncmp(con_options, "SSL", 3))
con_ssl= 1;
- else if (!strncmp(con_options, "COMPRESS", 8))
+ else if (length == 8 && !strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
- else if (!strncmp(con_options, "PIPE", 4))
+ else if (length == 4 && !strncmp(con_options, "PIPE", 4))
con_pipe= 1;
- else if (!strncmp(con_options, "SHM", 3))
+ else if (length == 3 && !strncmp(con_options, "SHM", 3))
con_shm= 1;
else
die("Illegal option to connect: %.*s",
@@ -5096,14 +5099,13 @@ void do_connect(struct st_command *comma
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
}
- else if(shared_memory_base_name)
+ else if (shared_memory_base_name)
{
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
- shared_memory_base_name);
+ shared_memory_base_name);
}
#endif
-
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
@@ -6879,10 +6881,8 @@ void run_query_stmt(MYSQL *mysql, struct
MYSQL_STMT *stmt;
DYNAMIC_STRING ds_prepare_warnings;
DYNAMIC_STRING ds_execute_warnings;
- ulonglong affected_rows;
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
- LINT_INIT(affected_rows);
/*
Init a new stmt if it's not already one created for this connection
@@ -6981,6 +6981,9 @@ void run_query_stmt(MYSQL *mysql, struct
handle_no_error(command);
if (!disable_result_log)
{
+ ulonglong affected_rows;
+ LINT_INIT(affected_rows);
+
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
@@ -7026,39 +7029,33 @@ void run_query_stmt(MYSQL *mysql, struct
Need to grab affected rows information before getting
warnings here
*/
- {
- ulonglong affected_rows;
- LINT_INIT(affected_rows);
+ if (!disable_info)
+ affected_rows= mysql_affected_rows(mysql);
- if (!disable_info)
- affected_rows= mysql_affected_rows(mysql);
+ if (!disable_warnings)
+ {
+ /* Get the warnings from execute */
- if (!disable_warnings)
+ /* Append warnings to ds - if there are any */
+ if (append_warnings(&ds_execute_warnings, mysql) ||
+ ds_execute_warnings.length ||
+ ds_prepare_warnings.length ||
+ ds_warnings->length)
{
- /* Get the warnings from execute */
-
- /* Append warnings to ds - if there are any */
- if (append_warnings(&ds_execute_warnings, mysql) ||
- ds_execute_warnings.length ||
- ds_prepare_warnings.length ||
- ds_warnings->length)
- {
- dynstr_append_mem(ds, "Warnings:\n", 10);
- if (ds_warnings->length)
- dynstr_append_mem(ds, ds_warnings->str,
- ds_warnings->length);
- if (ds_prepare_warnings.length)
- dynstr_append_mem(ds, ds_prepare_warnings.str,
- ds_prepare_warnings.length);
- if (ds_execute_warnings.length)
- dynstr_append_mem(ds, ds_execute_warnings.str,
- ds_execute_warnings.length);
- }
+ dynstr_append_mem(ds, "Warnings:\n", 10);
+ if (ds_warnings->length)
+ dynstr_append_mem(ds, ds_warnings->str,
+ ds_warnings->length);
+ if (ds_prepare_warnings.length)
+ dynstr_append_mem(ds, ds_prepare_warnings.str,
+ ds_prepare_warnings.length);
+ if (ds_execute_warnings.length)
+ dynstr_append_mem(ds, ds_execute_warnings.str,
+ ds_execute_warnings.length);
}
-
- if (!disable_info)
- append_info(ds, affected_rows, mysql_info(mysql));
}
+ if (!disable_info)
+ append_info(ds, affected_rows, mysql_info(mysql));
}
end:
@@ -7235,7 +7232,6 @@ void run_query(struct st_connection *cn,
}
dynstr_free(&query_str);
-
}
if (sp_protocol_enabled &&
@@ -7662,6 +7658,7 @@ int main(int argc, char **argv)
my_bool q_send_flag= 0, abort_flag= 0;
uint command_executed= 0, last_command_executed= 0;
char save_file[FN_REFLEN];
+ bool empty_result= FALSE;
MY_INIT(argv[0]);
save_file[0]= 0;
@@ -7819,6 +7816,7 @@ int main(int argc, char **argv)
verbose_msg("Start processing test commands from '%s' ...", cur_file->file_name);
while (!read_command(&command) && !abort_flag)
{
+ my_bool ok_to_do;
int current_line_inc = 1, processed = 0;
if (command->type == Q_UNKNOWN || command->type == Q_COMMENT_WITH_COMMAND)
get_command_type(command);
@@ -7831,7 +7829,7 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
- my_bool ok_to_do= cur_block->ok;
+ ok_to_do= cur_block->ok;
/*
Some commands need to be "done" the first time if they may get
re-iterated over in a true context. This can only happen if there's
@@ -8167,8 +8165,6 @@ int main(int argc, char **argv)
if (parsing_disabled)
die("Test ended with parsing disabled");
- my_bool empty_result= FALSE;
-
/*
The whole test has been executed _sucessfully_.
Time to compare result or save it to record file.
=== modified file 'configure.in'
--- a/configure.in 2009-11-16 20:49:51 +0000
+++ b/configure.in 2009-12-03 11:07:55 +0000
@@ -15,7 +15,7 @@ AC_CANONICAL_SYSTEM
# MySQL version number.
#
# Note: the following line must be parseable by win/configure.js:GetVersion()
-AM_INIT_AUTOMAKE(mysql, 5.1.41-mariadb-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.41-MariaDB-beta)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'mysql-test/lib/mtr_report.pm'
--- a/mysql-test/lib/mtr_report.pm 2009-11-16 20:49:51 +0000
+++ b/mysql-test/lib/mtr_report.pm 2009-12-03 11:07:55 +0000
@@ -388,7 +388,7 @@ MSG
}
elsif (@$extra_warnings)
{
- mtr_error("There were errors/warnings in server logs after running test cases.");
+ mtr_error("There where errors/warnings in server logs after running test cases.");
}
elsif ($fail)
{
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-27 13:20:59 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-12-03 11:07:55 +0000
@@ -201,10 +201,10 @@ my $opt_mark_progress;
my $opt_sleep;
-my $opt_testcase_timeout= 15; # minutes
-my $opt_suite_timeout = 300; # minutes
-my $opt_shutdown_timeout= 10; # seconds
-my $opt_start_timeout = 180; # seconds
+my $opt_testcase_timeout= 15; # 15 minutes
+my $opt_suite_timeout = 360; # 6 hours
+my $opt_shutdown_timeout= 10; # 10 seconds
+my $opt_start_timeout = 180; # 180 seconds
sub testcase_timeout { return $opt_testcase_timeout * 60; };
sub suite_timeout { return $opt_suite_timeout * 60; };
@@ -215,7 +215,7 @@ my $opt_start_dirty;
my $start_only;
my $opt_wait_all;
my $opt_repeat= 1;
-my $opt_retry= 3;
+my $opt_retry= 1;
my $opt_retry_failure= 2;
my $opt_strace_client;
@@ -612,8 +612,9 @@ sub run_test_server ($$$) {
my $fake_test= My::Test::read_test($sock);
my $test_list= join (" ", @{$fake_test->{testnames}});
push @$extra_warnings, $test_list;
+ my $report= $fake_test->{'warnings'};
mtr_report("***Warnings generated in error logs during shutdown ".
- "after running tests: $test_list");
+ "after running tests: $test_list\n\n$report");
$test_failure= 1;
if ( !$opt_force ) {
# Test failure due to warnings, force is off
@@ -1318,6 +1319,8 @@ sub command_line_setup {
{
# Indicate that we are using debugger
$glob_debugger= 1;
+ $opt_testcase_timeout= 60*60*24; # Don't abort debugging with timeout
+ $opt_suite_timeout= $opt_testcase_timeout;
$opt_retry= 1;
$opt_retry_failure= 1;
@@ -2150,7 +2153,6 @@ sub environment_setup {
# Create an environment variable to make it possible
# to detect that valgrind is being used from test cases
$ENV{'VALGRIND_TEST'}= $opt_valgrind;
-
}
@@ -2907,8 +2909,8 @@ sub mysql_install_db {
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
my $path_sql= my_find_file($install_basedir,
- ["mysql", "sql/share", "share/mysql",
- "share/mariadb", "share", "scripts"],
+ ["mysql", "sql/share", "share/mariadb",
+ "share/mysql", "share", "scripts"],
"mysql_system_tables.sql",
NOT_REQUIRED);
@@ -3860,7 +3862,7 @@ sub extract_server_log ($$) {
my ($error_log, $tname) = @_;
# Open the servers .err log file and read all lines
- # belonging to current tets into @lines
+ # belonging to current test into @lines
my $Ferr = IO::File->new($error_log)
or mtr_error("Could not open file '$error_log' for reading: $!");
@@ -3999,9 +4001,11 @@ sub extract_warning_lines ($) {
qr/Slave I\/O: Get master COLLATION_SERVER failed with error:.*/,
qr/Slave I\/O: Get master TIME_ZONE failed with error:.*/,
qr/Slave I\/O: error reconnecting to master '.*' - retry-time: [1-3] retries/,
+ qr/Error reading packet/,
+ qr/Slave: Can't drop database.* database doesn't exist/,
);
- my $match_count= 0;
+ my $matched_lines= [];
LINE: foreach my $line ( @lines )
{
PAT: foreach my $pat ( @patterns )
@@ -4013,18 +4017,18 @@ sub extract_warning_lines ($) {
next LINE if $line =~ $apat;
}
print $Fwarn $line;
- ++$match_count;
+ push @$matched_lines, $line;
last PAT;
}
}
}
$Fwarn = undef; # Close file
- if ($match_count > 0 &&
+ if (scalar(@$matched_lines) > 0 &&
defined($last_warning_position->{$error_log}{test_names})) {
- return $last_warning_position->{$error_log}{test_names};
+ return ($last_warning_position->{$error_log}{test_names}, $matched_lines);
} else {
- return [];
+ return ([], $matched_lines);
}
}
@@ -4201,14 +4205,18 @@ sub check_warnings ($) {
sub check_warnings_post_shutdown {
my ($server_socket)= @_;
my $testname_hash= { };
+ my $report= '';
foreach my $mysqld ( mysqlds())
{
- my $testlist= extract_warning_lines($mysqld->value('#log-error'));
+ my ($testlist, $match_lines)=
+ extract_warning_lines($mysqld->value('#log-error'));
$testname_hash->{$_}= 1 for @$testlist;
+ $report.= join('', @$match_lines);
}
my @warning_tests= keys(%$testname_hash);
if (@warning_tests) {
my $fake_test= My::Test->new(testnames => \@warning_tests);
+ $fake_test->{'warnings'}= $report;
$fake_test->write_test($server_socket, 'WARNINGS');
}
}
=== modified file 'mysql-test/suite/federated/disabled.def'
--- a/mysql-test/suite/federated/disabled.def 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/disabled.def 2009-11-14 19:33:59 +0000
@@ -9,5 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-federated_server : needs fixup
=== modified file 'mysql-test/suite/federated/federated_server.result'
--- a/mysql-test/suite/federated/federated_server.result 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/federated_server.result 2009-11-14 19:33:59 +0000
@@ -175,6 +175,8 @@ CREATE TABLE db_bogus.t1 (
)
;
INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
+create user test_fed@localhost identified by 'foo';
+grant all on db_legitimate.* to test_fed@localhost;
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
@@ -211,15 +213,14 @@ id name
alter server s1 options (database 'db_bogus');
flush tables;
select * from federated.t1;
-id name
-2 this is bogus
+ERROR HY000: There was a problem processing the query on the foreign data source. Data source error: : 1044 : Access denied for user 'test_fed'@'localhost' to databa
drop server if exists 's1';
ERROR 42000: Access denied; you need the SUPER privilege for this operation
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@@ -228,8 +229,8 @@ drop server 's1';
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@@ -237,6 +238,7 @@ flush tables;
select * from federated.t1;
id name
1 this is legitimate
+drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;
drop user guest_super@localhost;
@@ -275,6 +277,6 @@ call p1();
drop procedure p1;
drop server if exists s;
DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;
=== modified file 'mysql-test/suite/federated/federated_server.test'
--- a/mysql-test/suite/federated/federated_server.test 2009-10-30 18:50:56 +0000
+++ b/mysql-test/suite/federated/federated_server.test 2009-11-14 19:33:59 +0000
@@ -239,6 +239,7 @@ alter server s1 options (database 'db_bo
connection master;
flush tables;
+--error ER_QUERY_ON_FOREIGN_DATA_SOURCE
select * from federated.t1;
connection conn_select;
@@ -249,8 +250,8 @@ drop server if exists 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
- USER 'root',
- PASSWORD '',
+ USER 'test_fed',
+ PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@@ -261,8 +262,8 @@ drop server 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
- USER 'root',
- PASSWORD '',
+ USER 'test_fed',
+ PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@@ -273,6 +274,7 @@ select * from federated.t1;
# clean up test
connection slave;
+drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;
=== modified file 'storage/federatedx/ha_federatedx.cc'
--- a/storage/federatedx/ha_federatedx.cc 2009-11-16 20:49:51 +0000
+++ b/storage/federatedx/ha_federatedx.cc 2009-12-03 11:07:55 +0000
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2008, Patrick Galbraith
+Copyright (c) 2008-2009, Patrick Galbraith & Antony Curtis
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -308,7 +308,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/
-#define MYSQL_SERVER 1q
+#define MYSQL_SERVER 1
#include "mysql_priv.h"
#include <mysql/plugin.h>
@@ -1627,7 +1627,13 @@ static int free_server(federatedx_txn *t
{
MEM_ROOT mem_root;
- txn->close(server);
+ if (!txn)
+ {
+ federatedx_txn tmp_txn;
+ tmp_txn.close(server);
+ }
+ else
+ txn->close(server);
DBUG_ASSERT(server->io_count == 0);
@@ -1785,21 +1791,25 @@ int ha_federatedx::close(void)
if (stored_result)
retval= free_result();
- /* Disconnect from mysql. thd may be null during refresh */
- txn= thd ? get_txn(thd, true) : new federatedx_txn();
+ /* Disconnect from mysql */
+ if (!thd || !(txn= get_txn(thd, true)))
+ {
+ federatedx_txn tmp_txn;
+
+ tmp_txn.release(&io);
- if (txn)
+ DBUG_ASSERT(io == NULL);
+
+ if ((error= free_share(&tmp_txn, share)))
+ retval= error;
+ }
+ else
{
txn->release(&io);
-
DBUG_ASSERT(io == NULL);
if ((error= free_share(txn, share)))
retval= error;
-
- if (!thd)
- delete txn;
-
}
DBUG_RETURN(retval);
}
@@ -2793,14 +2803,16 @@ int ha_federatedx::rnd_end()
int ha_federatedx::free_result()
{
int error;
+ federatedx_io *tmp_io= 0, **iop;
DBUG_ASSERT(stored_result);
- if ((error= txn->acquire(share, FALSE, &io)))
+ if (!*(iop= &io) && (error= txn->acquire(share, TRUE, (iop= &tmp_io))))
{
DBUG_ASSERT(0); // Fail when testing
return error;
}
- io->free_result(stored_result);
+ (*iop)->free_result(stored_result);
stored_result= 0;
+ txn->release(&tmp_io);
return 0;
}
@@ -2985,7 +2997,7 @@ int ha_federatedx::info(uint flag)
{
char error_buffer[FEDERATEDX_QUERY_BUFFER_SIZE];
uint error_code;
- federatedx_io *tmp_io= 0;
+ federatedx_io *tmp_io= 0, **iop= 0;
DBUG_ENTER("ha_federatedx::info");
error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
@@ -2993,7 +3005,7 @@ int ha_federatedx::info(uint flag)
/* we want not to show table status if not needed to do so */
if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO))
{
- if ((error_code= txn->acquire(share, TRUE, &tmp_io)))
+ if (!*(iop= &io) && (error_code= txn->acquire(share, TRUE, (iop= &tmp_io))))
goto fail;
}
@@ -3006,13 +3018,13 @@ int ha_federatedx::info(uint flag)
if (flag & HA_STATUS_CONST)
stats.block_size= 4096;
- if (tmp_io->table_metadata(&stats, share->table_name,
+ if ((*iop)->table_metadata(&stats, share->table_name,
share->table_name_length, flag))
goto error;
}
if (flag & HA_STATUS_AUTO)
- stats.auto_increment_value= tmp_io->last_insert_id();
+ stats.auto_increment_value= (*iop)->last_insert_id();
/*
If ::info created it's own transaction, close it. This happens in case
@@ -3023,10 +3035,10 @@ int ha_federatedx::info(uint flag)
DBUG_RETURN(0);
error:
- if (tmp_io)
+ if (iop && *iop)
{
my_sprintf(error_buffer, (error_buffer, ": %d : %s",
- tmp_io->error_code(), tmp_io->error_str()));
+ (*iop)->error_code(), (*iop)->error_str()));
my_error(error_code, MYF(0), error_buffer);
}
else
=== modified file 'unittest/mysys/Makefile.am'
--- a/unittest/mysys/Makefile.am 2009-11-26 08:44:38 +0000
+++ b/unittest/mysys/Makefile.am 2009-12-03 11:07:55 +0000
@@ -24,7 +24,7 @@ LDADD = $(top_builddir)/unittest/mytap
$(top_builddir)/strings/libmystrings.a
EXTRA_DIST = CMakeLists.txt
-noinst_PROGRAMS = bitmap-t base64-t lf-t waiting_threads-t
+noinst_PROGRAMS = bitmap-t base64-t my_atomic-t lf-t waiting_threads-t
if NEED_THREAD
# my_atomic-t is used to check thread functions, so it is safe to
1
0

[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2776)
by knielsen@knielsen-hq.org 02 Dec '09
by knielsen@knielsen-hq.org 02 Dec '09
02 Dec '09
#At lp:maria
2776 knielsen(a)knielsen-hq.org 2009-12-02
Fix PBXT crash during shutdown if shutdown happens early (like wrong command args).
modified:
storage/pbxt/src/myxt_xt.cc
=== modified file 'storage/pbxt/src/myxt_xt.cc'
--- a/storage/pbxt/src/myxt_xt.cc 2009-12-01 09:50:46 +0000
+++ b/storage/pbxt/src/myxt_xt.cc 2009-12-02 18:07:59 +0000
@@ -3112,10 +3112,19 @@ xtPublic void *myxt_create_thread()
* references to the PBXT plugin object and will effectively deadlock the plugin so
* that server will have to force plugin shutdown. To avoid deadlocking and forced shutdown
* we must dereference the plugin after creating THD objects.
+ * Similarly to global_system_variables.table_plugin as described above,
+ * new_thd->valriables.table_plugin can also become NULL due to shutdown.
*/
- LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(new_thd->variables.table_plugin)->name;
+ plugin_ref table_plugin = new_thd->variables.table_plugin;
+ if (!table_plugin) {
+ delete new_thd;
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_MYSQL_NO_THREAD);
+ return NULL;
+ }
+
+ LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(table_plugin)->name;
if ((plugin_name.length == 4) && (strncmp(plugin_name.str, "PBXT", plugin_name.length) == 0)) {
- REF_MYSQL_PLUGIN(new_thd->variables.table_plugin)->ref_count--;
+ REF_MYSQL_PLUGIN(table_plugin)->ref_count--;
}
new_thd->thread_stack = (char *) &new_thd;
new_thd->store_globals();
1
0